I have a data frame that looks something like this:
Game Team Value
1 A 0.6
1 B 0.5
2 C 1.2
2 D 0.3
I want to create a new column that calculates the difference in 'value' for a given game, so it would be:
difference
0.1
-0.1
0.9
-0.9
In other words I want to group by the 'game' but I'm not quite sure how to do this