You are here

Re-Randomize Twin Order

3 posts / 0 new
Last post
Hal's picture
Joined: 09/10/2021 - 01:09
Re-Randomize Twin Order

Is there a code to re-randomize twin order?


AdminNeale's picture
Joined: 03/01/2013 - 14:09
Not afaik

I haven't got any myself, but presumably, it's pretty straightforward to put twin 1 variables in one vector, twin 2 variables in another, and then call runif(1) to choose whether to flip the order, possibly using a dummy vector, dummy<-twin1; twin1<-twin2; twin2<-dummy. Or simply write them to a new dataset c(twin1,twin2) or c(twin2,twin1).

AdminRobK's picture
Joined: 01/24/2014 - 12:15
OSDZ twin pairs

One thing to add: you need to be careful if you have opposite-sex dizygotic twins in your dataset, because the script you're using might assume that, say, twin 1 is always the male and twin 2 is always the female.