I have a data.frame of the following structure (panel data), with 16 levels of time(quarters) 14 levels of geo (countries) and 20 levels of citizen, each of them repeating accordingly in the dataframe.
  time     geo                          citizen      X 
2008Q1 Belgium                      Afghanistan     22
2008Q1 Belgium                          Armenia     10
2008Q1 Belgium                       Bangladesh     25
2008Q1 Belgium Democratic Republic of the Congo     55
2008Q1 Belgium      China (including Hong Kong)      5
2008Q1 Belgium                          Eritrea      8
I would like to create a new column lets say MOVSUM where it will sum variable X for each level of citizen and geo and time for the previous 4 quarters, so that I would have for each quarter, t, how many X's of each citizen in each geo were available during t-4 to t-1 quarters.
Thanks in advance
