# Sampling method for constructing multiple groups from a given pool

There is a set A having $N$ elements. Based on set A, I would like to construct $M$ groups, where each group has $P$ elements. Naturally, $M P <N$. All of those elements in the $M$ groups are sampled from set A by following the two criteria, they are different with each other; the sampling probability for each of these MP elements are the same.

Which kind of sampling method should I use? How to do that in R?

• What exactly do you mean by "based on set A"? And you write that "Naturally, M *P", what do you mean by that? Did you mean that $M\times P=N$? – Stephan Kolassa Nov 29 '12 at 16:23
• "based on set A" means that all of those MP elements are sampled from A. MP can be smaller than N. – user3269 Nov 29 '12 at 16:35
• I edited my answer based on your comment. Is this what you need? – Stephan Kolassa Nov 29 '12 at 16:40

A <- LETTERS[1:20]

Then each row of the matrix gives you one group of size $P$. Alternatively, you can sample with replacement:
matrix(sample(A,size=M*P,replace=TRUE),nrow=M, ncol=P)