I have this data frame (StudySample_cc):
FullName Quality Abn
I would like to create a new data frame with 100 random rows for each FullName. So for John Doe I want 100 entries, Jane Doe I want 100 entries, etc.
I tried
do.call( rbind, lapply( split(StudySample_cc, StudySample_cc$FullName) , function(StudySample_cc) StudySample_cc[sample(nrow(StudySample_cc), 100) , ] )
But no luck. Any help?
Aucun commentaire:
Enregistrer un commentaire