[R] permutation of vectors (1 or 0)

Jeffrey Dick j3ffdick at gmail.com
Thu Dec 20 14:40:15 CET 2012


you might also try (names modified a bit since R already has a NULL object)

> Zeros <- rep(0,10)
> Ones <- rep(1,10)
> expand.grid(Map(c, Zeros, Ones))


On Thu, Dec 20, 2012 at 9:24 PM, Olga Lyashevska <olga at herenstraat.nl> wrote:
> On 12/20/2012 02:13 PM, arun wrote:
>> library(gtools)
>> permutations(2,10,0:1,repeats.allowed=TRUE)
>
>
> Thanks, this is exactly what I need.
>
> Regards,
> Olga
>
> ______________________________________________
> 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.




More information about the R-help mailing list