mercredi 28 octobre 2020

Sampling by quantiles in RStudio

I have a dataset in RStudio containing a column with all counties, a column with their respective states and another with their estimated population. I want to sample 2 random counties from each state. The sample however has to be composed by approximately one fifth of counties in each quintile by population. How should I go about it? I know that I can calculate the quintiles using the quantile() function, but not really sure how to proceed from there.




Aucun commentaire:

Enregistrer un commentaire