[R] Sampling from a population

Andrew Criswell arc at arcriswell.com
Tue Nov 20 05:42:21 CET 2001


Suppose you have a population of N <- 5 observations, x <- c(43, 28, 7, 61, 39). From that you can draw a maximum of 10 samples without replacement of size n <- 3. (Command choose(N,n) yields 10). For instance the samples I seek are

    43, 61, 7
    39, 7, 28  ...etc

How can I get R to do that for me, to get an exhaustive list of samples of size n drawn without replacement from a population of size N?  The command, sample(x, 3, replace=FALSE), works well for one draw. Is there a package that will handle multiple draws?

Thanks and best wishes,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20011120/40da9b3e/attachment.html

More information about the R-help mailing list