[R] All permutations

Ravi Varadhan rvaradha at jhsph.edu
Wed Sep 18 15:37:28 CEST 2002


Hi:

 I would like to obtain all permutations of size n containing the k distinct
objects. For example, for size n=3 and k=2 objects (1 and 2), I want the
following 8x3 matrix:

 1 1 1
 1 1 2
 1 2 1
 2 1 1
 1 2 2
 2 2 1
 2 1 2
 2 2 2

 Is there any R function to accomplish this?

 Thanks for the help,
 Ravi.



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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