I have a df that takes this general form:
ID votes
1 65
1 85
2 100
2 20
2 95
3 50
3 60
I want to create a new df that takes the two highest values in votes for each ID and shows their difference. The new df should look like this:
ID margin
1 20
2 5
3 10
Is there a way to use dplyr for this?