lundi 19 février 2018

R: how to sample rows with custom frequencies

I have a data frame in R that has two columns, one with last names, the other with the frequency of each last name. I would like to randomly select last names based on the frequency values (0 -> 1).

So far I have tried using the sample function, but it doesn't allow for specific frequencies for each value. Not sure if this is possible :/




Aucun commentaire:

Enregistrer un commentaire