[R] All permutations

Juan Ramon Gonzalez jrgonzalez at ico.scs.es
Wed Sep 25 09:09:47 CEST 2002


Ravi,

Look at the gregmisc package and  "permutations" function

Juan

----- Original Message -----
From: "David Meyer" <david.meyer at ci.tuwien.ac.at>
To: "Ravi Varadhan" <rvaradha at jhsph.edu>
Cc: "R-Help (E-mail)" <r-help at stat.math.ethz.ch>
Sent: Wednesday, September 18, 2002 7:24 PM
Subject: Re: [R] All permutations


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

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