Re: [R] expand.grid using a repeated vector as a parameter

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Fri, 02 May 2008 12:34:47 -0600

Try:

> tmp <- rep( list( 0:1 ), 5 )
> out <- do.call(expand.grid, tmp)

Then change the 5 to whatever you want.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Simon Parker
> Sent: Friday, May 02, 2008 11:50 AM
> To: r-help_at_r-project.org
> Subject: [R] expand.grid using a repeated vector as a parameter
>
> Hello.
>
>
> I'm trying to do this (not necessarily 0:1) :
>
>
> expand.grid ( 0:1, 0:1, 0:1, 0:1, 0:1)
>
> etc..etc.
>
>
> but I want to have control over how many 0:1 are included.
>
>
> Any ideas please ?
>
> Thankyou.
>
>
> Simon Parker
> Imperial College
>
>
>
>
> ---------------------------------
>
> A Smarter Email.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org 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_r-project.org 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.
Received on Fri 02 May 2008 - 19:02:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 02 May 2008 - 19:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive