dimanche 3 juin 2018

Matching output of sample() with rbinom() in R?

Maybe this too simple of a question but shouldn't A and B be exactly equal in my below R code:

set.seed(0)
A <- sample(0:1, 50, prob = rep(.5, 2), replace = T) # 'A' is HERE
plot(table(A))

set.seed(0)
B <- rbinom(50, 1, .5)  # 'B' is HERE
plot(table(B))




Aucun commentaire:

Enregistrer un commentaire