dimanche 24 septembre 2017

R - how to pick a random sample with specific percentages

This is snapshot of my dataset

A B
1 45 1 67 1 56 0 55 0 10 0 34 0 98 I am trying to create a sample where there are 2 1s and 3 0s in the sample along with their respective B values. Is there a way to do that? Basically how to get a sample with specific percentages of a particular column? Thanks




Aucun commentaire:

Enregistrer un commentaire