[R] Possible pair of 2 binary vectors

2014-08-09 Thread Ron Michael
Hi, Let say I haveĀ 2 binary vectors of length 'd', therefore both these vectors can take only 0-1 values. Now I want to simulate all possible pairs of them. Theoretically there will be 4^d possible pairs. Is there any R function to directly simulate them? Thanks for your help.

Re: [R] Possible pair of 2 binary vectors

2014-08-09 Thread Jorge I Velez
Dear Ron, What about this? set.seed(123) d - 4 x1 - sample(0:1, d, TRUE) x2 - sample(0:1, d, TRUE) x1 x2 expand.grid(x1 = x1, x2 = x2) See ?expand.grid for more information. Best, Jorge.- On Sat, Aug 9, 2014 at 7:46 PM, Ron Michael ron_michae...@yahoo.com wrote: Hi, Let say I have 2