Dear R People: Suppose I have the 4 numbers: 1,2,3,4. I would like to create a listing of the permutations of 4 items taken 4 at a time. Is there a built in function for that, please? Thanks in advance! R 2-3-1 for Windows or Linux Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: hodgess at gator.uhd.edu
not very-well hidden: permutations in (e1071) permn in (combinat) David L. Reiner Rho Trading Securities, LLC Chicago IL 60605 312-362-4963 -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Erin Hodgess Sent: Wednesday, August 02, 2006 11:57 AM To: r-help at stat.math.ethz.ch Subject: [R] listing of permutations Dear R People: Suppose I have the 4 numbers: 1,2,3,4. I would like to create a listing of the permutations of 4 items taken 4 at a time. Is there a built in function for that, please? Thanks in advance! R 2-3-1 for Windows or Linux Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: hodgess at gator.uhd.edu ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Erin: You got 2 (so far) pre-packaged functions .Here's an obscenely inefficient but short un-prepackaged way to do it: k<-4 z<- do.call('expand.grid',as.data.frame(matrix(rep(1:k,k),nc=k))) results<- z[apply(z,1,function(x)length(unique(x))==k),] It is too inefficient to make public, though. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Erin Hodgess > Sent: Wednesday, August 02, 2006 9:57 AM > To: r-help at stat.math.ethz.ch > Subject: [R] listing of permutations > > Dear R People: > > Suppose I have the 4 numbers: 1,2,3,4. > > I would like to create a listing of the permutations > of 4 items taken 4 at a time. > > Is there a built in function for that, please? > > Thanks in advance! > R 2-3-1 for Windows or Linux > Sincerely, > Erin Hodgess > Associate Professor > Department of Computer and Mathematical Sciences > University of Houston - Downtown > mailto: hodgess at gator.uhd.edu > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >