On Jan 29, 2012, at 11:21 AM, Ron Michael wrote:
Dear all, here I need to draw all possible samples of size 2, from a population, which is characterized by c(1,4,56, 3).
> combn(c(1,4,56, 3), 2) # an enumeration of possible tuples [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 1 1 4 4 56 [2,] 4 56 3 56 3 3
Sampling will be done with replacement. Is there any direct R function to faciliate this darwing?
Here is an implementation of such a sample from that matrix. > combn(c(1,4,56, 3), 2)[ , sample(1:6, 10, replace=TRUE)] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 56 4 4 1 4 1 1 1 1 1 [2,] 3 3 56 4 3 4 4 3 56 3 -- David Winsemius, MD West Hartford, CT ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.