Hi!
I have a dataframe that sort of has the following structure:
ID Code City Water usage
1 start London 10
2 start London 5
3 start Amsterdam 20
4 middle London 100
5 end London 140
6 end Amsterdam 80
I want to do the following:
- I want, for instance, to subtract the sum of waterusage in London with the code 'start' from the water usage in London with the code 'middle'. And the similar for middle and end.
I already made a subset of the IDs that have the code 'start' and used aggregate to sum the water use by city.
Any suggestions on how to continue?