I have a dataset that I want to randomly sample up to 6 rows for each animal ID per day. Not every animal ID was sampled each day, and some animals were sampled less than 6 times per day. For example - if an animal was only sampled 2 times in a given day, then I want to retain both those samples. I want to retain all the info in the sampled row.
in the image:
- New_ID is the animal Id
- New_Date_Hour is the hour of the day (this is the variable that I want to randomly sample 6 times per day)
There are 13 different animal IDs
I have tried a few different approaches but without success.
Aucun commentaire:
Enregistrer un commentaire