[R] listing of permutations
Berton Gunter
gunter.berton at gene.com
Wed Aug 2 19:44:12 CEST 2006
I seem to be on a roll of being dumb today. Sorry for posting my previous
silly solution to Erin's permutation problem. Please **do** ignore it.
-- Bert
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Berton Gunter
> Sent: Wednesday, August 02, 2006 10:32 AM
> To: 'Erin Hodgess'; r-help at stat.math.ethz.ch
> Subject: Re: [R] listing of permutations
>
> 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.
> >
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list