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: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Erin Hodgess
> Sent: Wednesday, August 02, 2006 9:57 AM
> To: r-help@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: [EMAIL PROTECTED]
> 
> ______________________________________________
> R-help@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.
>

______________________________________________
R-help@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.

Reply via email to