Skip to content
Prev 106752 / 398506 Next

Error: cannot take a sample larger than the population

Aldi Kraja wrote:
So why not use replace = TRUE ?

xlrmN1 <- sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ), replace=TRUE)

table(xlrmN1)
xlrmN1
  0   1   2
  5 373  22

prop.table(table(xlrmN1))
xlrmN1
     0      1      2
0.0125 0.9325 0.0550