Add random numbers randomly in a DataFrame in R

500 random numbers with 0 or 1 values:

a <-sample(0:1, 500, rep = TRUE)
 
# 0 1 1 0 0 0 1 0 ...
Content Protection by DMCA.com
Please Share