Hi everyone!

My dataset is composed of 4122 observations: 83 cities and for each observation to 1901 to 1950. I would like to calculate the average mortality of influenza from 1901 to 1917 for each city. And after that, I would like to compute the average mortality of influenza from 1918 to 1920. To finish, I need to subtract these two averages
Thus, I guess that I have to generate the two averages but I don't know how to code to have the averages that I desire

I'm really sorry if my question is a bit easy but I already checked during a few hours for an answer without result
Thanks in advance!