[R] exhaustive permutations

Thomas Lumley tlumley at u.washington.edu
Wed Jan 16 17:25:06 CET 2002


On Wed, 16 Jan 2002, Nick Bond wrote:

> However, where sample sizes are small, it is more appropriate (I think)
> to exhaustively calculate all possible permutations.  This is equivalent
> to determining all possible ways of assigning n samples to each of k
> groups = (kn)!/[(n!)^k*k!].  As a relative beginner at programming, I
> suspect that writing the code to determine (and list) these permutations
> is far beyond me.  I am wondering, therefore, whether anyone out there
> has done somehting similar, or knows of any suitable routine to
> calculate these permutations that they would be willing to share with
> me.

The k=2 case is discussed in the first two "Programmers' Niche" columns of
the R Newsletter. This should provide a starting point.

	-thomas


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list