[R] permutation of vectors (1 or 0)

Martin Maechler maechler at stat.math.ethz.ch
Fri Dec 21 08:51:41 CET 2012


>>>>> Jeffrey Dick <j3ffdick at gmail.com>
>>>>>     on Thu, 20 Dec 2012 21:40:15 +0800 writes:

    > 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))

Wow -- really neat!

Thank you, Jeff




More information about the R-help mailing list