I have a data frame with 6 columns (only show a few below as an example). I need to randomly sample x rows 100 times for each "level" of the data. I've tried do this with the data in data.frame, list, etc and I've tried various forms of %in%, level=="2", etc. from a number of different posts I've found here on stack, but nothing seems to work and most attempts just result in errors. Not sure if it's because my levels are numeric or what. I could have sworn I found a solution to this a week ago, but I've been scouring stack for hours now and can't find it. Any suggestions would be appreciated! Thanks!
Here is an example of what the data look like:
level val1 val2
2 0.2 0.3
5 0.1 0.3
6 0.2 0.4
2 0.1 0.4
2 0.6 0.1
5 0.5 0.4
5 0.1 0.3
6 0.2 0.4
2 0.1 0.4
2 0.6 0.1
5 0.5 0.4
5 0.1 0.3
6 0.2 0.4
2 0.1 0.4
2 0.6 0.1
5 0.5 0.4
Aucun commentaire:
Enregistrer un commentaire