mardi 11 août 2020

How do I generate a random sample in R using the set.seed() function?

I am getting different values whenever I use the set.seed() command compared to the ones given as correct answers despite using the same command:

set.seed(1)
X <- sample(x,25)
mean(X)

So, I was advised to run the code below before running the set.seed() command:

RNGkind(sample.kind = "Rounding")

However, I'm getting this error

Error in RNGkind(sample.kind = "Rounding"): 
  unused argument (sample.kind = "Rounding")

How do I fix this problem?




Aucun commentaire:

Enregistrer un commentaire