[R] All permutations
David Meyer
david.meyer at ci.tuwien.ac.at
Wed Sep 18 19:24:18 CEST 2002
v <- 1:2
expand.grid(v,v,v)
g.,
-d
Ravi Varadhan wrote:
>
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
--
Mag. David Meyer Wiedner Hauptstrasse 8-10
Vienna University of Technology A-1040 Vienna/AUSTRIA
Department of Tel.: (+431) 58801/10772
Statistics and Probability Theory mail: david.meyer at ci.tuwien.ac.at
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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