[R] permutation of vectors (1 or 0)

olga30dec olga at herenstraat.nl
Thu Dec 20 13:52:24 CET 2012


Dear all,

I have 2 vectors of 10 elements, each of them contains either 0 or 1, like
following:

> Null<-rep(0,10)
> Null
 [1] 0 0 0 0 0 0 0 0 0 0

> One<-rep(1,10)
> One
 [1] 1 1 1 1 1 1 1 1 1 1

How can I obtain a matrix rows of which can take all possible combinations?

e.g.
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0
...
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 1 1
 1 1 1 1 1 1 1 1 1 1

Many thanks,
Olga




--
View this message in context: http://r.789695.n4.nabble.com/permutation-of-vectors-1-or-0-tp4653607.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list