I have a dataset of scores:
ID Sub Score
1 Mat 45
2 Mat 34
3 Mat 67
1 Mat 43
2 Mat 34
4 Mat 22
5 Sci 78
6 Mat 32
1 Mat 56
1 Sci 40
I want to output only the top scores for each ID in each subject. For example, the new list should show:
ID Sub Score
2 Mat 34
3 Mat 67
4 Mat 22
5 Sci 78
6 Mat 32
1 Mat 56
1 Sci 40
I can find the duplicated results through:
results[duplicated(results[, c(1,2)]),]
How to order the results and delete the lowest scoring ones?