I am trying to generate random pairs from 34 subjects for an experiment. Subjects will be assigned ID #'s 1-34. To generate the random ordered numbers (1-34) I used the following code:
### Getting a vector of random ordered numbers 1-34###
pairs<-sample(1:34,34,replace=F)
pairs
[1] 16 22 8 13 4 25 18 12 17 5 6 31 29 27 30 23 2 14 9 24 34 21 11
3 1 28 33 20 32 26 19 10 15 7
What I would like to do is to take this random ordering of numbers and split every other element of the vector into a column so that I get the following ordered pairs:
partner1 partner2
16 22
8 13
. .
. .
15 7
Thoughts or ideas on how to go from the vector to the ordered pairs? Any help or insight would be much appreciated.
-Thomas