Skip to content
Prev 322159 / 398500 Next

Vector with zeros and ones

On Apr 22, 2013, at 6:28 PM, Marc Schwartz <marc_schwartz at me.com> wrote:

            
BTW, I should have mentioned, if you want to sample() as above repeatedly, use ?replicate:

# Repeat the above sampling 5 times:
set.seed(1)
[,1] [,2] [,3] [,4] [,5]
 [1,]    1    1    1    1    1
 [2,]    1    0    0    1    1
 [3,]    1    1    1    1    1
 [4,]    1    1    0    0    1
 [5,]    0    1    1    1    1
 [6,]    1    1    1    1    1
 [7,]    1    1    1    1    0
 [8,]    1    1    1    0    0
 [9,]    1    0    1    1    1
[10,]    0    1    1    1    1


Regards,

Marc