mercredi 22 janvier 2020

Sample_n in R Gives the Same Sample Almost Every Time

When I run my the following code which should give a random sample of the rows in my table, I get the same sample almost every time. Very rarely will the code actually yield a unique sample which is really strange because none of my samples are identical.

nonpdf <- sample_n(nonpdata,pcount, replace = FALSE)

I have tried deleting the dataframe at the end of my code with hopes that it would trigger a new random sample but no luck. The code I used for that was:

rm(nonpdf)

What can I do to get this to actually give a random sample?

The sample data is just a table of boolean values with 5,000+ rows and 317 columns. However, the same 10 rows are selected every time I run the code above.




Aucun commentaire:

Enregistrer un commentaire