dimanche 7 juin 2015

How to take same random sample from dataset every time

I have a dataset that consists of nearly 7 million observations and I want to take a random sample of the data to analyze just a subset. I know how to take a random sample of the data:

index <- sample(7009728, 50000)
flights <- flight[index, ]

Is there a way to take a random sample but once created in my dataset, to always give me the same random sample? I'm hoping to do this without having to rely on saving my R project.




Aucun commentaire:

Enregistrer un commentaire