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

thmsfuller066 at gmail.com thmsfuller066 at gmail.com
Sun May 23 01:06:20 CEST 2010


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 previous draws. I could use expand.grid to
generate a vector out of the three vectors. But when the number of
vectors are large and the number of elements in some vectors are
large, it will be infeasible to do so.

If you know there is a method on sampling on more than one variables,
would you please let me know? Thank you!

-- 
Tom



More information about the R-help mailing list