I would like to calculate the amount of rainfall that has fallen in the last three days for each square of the grid, and add this as a new column in my data table. To be clear, I want to summarize the current and PREVIOUS two (2) days of precipitation, for each square of the metrological grid
library ( zoo ) library (data.table)
My attempt to answer: this line was used to work, but no longer works
weather[, rain_3 := filter(rain, rep(1, 2), sides = 1), by = list(square)]
So I'm trying another method:
I would really appreciate any ideas or suggestions you might have.
Thank you very much!
source share