Here is what my data looks like
Animal Age Weight
Cow 5 100
Pig 4 80
Pig 4 85
Sheep 2 60
Sheep 3 65
Sheep 3 75
The data is sorted by animal, then by age within animal groups, and then by weight (increasing).
Is there a way to subset this data so that I am left with only the lightest animals for each animal group AND age group? This is what the output would become:
Animal Age Weight
Cow 5 100
Pig 4 80
Sheep 2 60
Sheep 3 65
edit: I forgot to mention that I want to be able to retain any additional information in each of the rows when assigning it to the new dataset. For example, if there was another column containing information about farm location, I want to keep that. Also, I want to disregard ties, it doesn't matter which of the results it keeps, as long as it keeps one.