I have a data.frame with multiple monthly time series data. I would like to dplyr::group_by() "year" and for all different time series simultaneously divide each observation within the group by the December value of the previous group (e.g.: I'd like to divide all observations within the year 2020 (across all different time series) by the December value of the year 2019 of each respective time series).
When grouping by a specific grouping variable, is it possible to access values that lie outside the specific group the function presently operates on (e.g.: the values of the group before my presently operated on group)?
What would be your preferred / best practice to do so?
I'd appreciate your help and guidance. Thank you!