[R] How sample without replacement on more than one variables?

2010-05-23 Thread thmsfuller...@gmail.com
Hello All, sample() only sample on one variable x. But I'm interested in sampling more than one variable without replacement. Suppose I have 3 vectors x, y, z. I want to draw samples from all three vectors such that the combination of the three elements in each draw is not the same as any

Re: [R] How sample without replacement on more than one variables?

2010-05-23 Thread Erik Iverson
thmsfuller...@gmail.com wrote: Hello All, sample() only sample on one variable x. But I'm interested in sampling more than one variable without replacement. Suppose I have 3 vectors x, y, z. I want to draw samples from all three vectors such that the combination of the three elements in each

Re: [R] How sample without replacement on more than one variables?

2010-05-23 Thread dusadrian
This might help, depending on your exact needs: v1 - sample(letters[1:2], 10, replace=TRUE) v2 - sample(letters[3:4], 10, replace=TRUE) v3 - sample(letters[5:6], 10, replace=TRUE) aa - data.frame(v1=v1, v2=v2, v3=v3) aa v1 v2 v3 1 a d e 2 a d e 3 a c e 4 b d e 5 b d f

Re: [R] How sample without replacement on more than one variables?

2010-05-23 Thread Bernardo Rangel Tura
On Sun, 2010-05-23 at 00:56 -0700, dusadrian wrote: This might help, depending on your exact needs: v1 - sample(letters[1:2], 10, replace=TRUE) v2 - sample(letters[3:4], 10, replace=TRUE) v3 - sample(letters[5:6], 10, replace=TRUE) aa - data.frame(v1=v1, v2=v2, v3=v3) And now is simple,