I have daily precipitation data from 1880-2011. The data is in a df called STATION and takes the form:
STATION: 47486 obs. of 4 variables
Year: int 1880 1880 ...
Month: int 1 1 1 ...
Day: int 1 2 3 ...
PPT: num 0.4 0 0 ...
I have used the following to group the data into mean monthly precipitation amounts when daily precipitation exceeds 0.2mm:
MONTHLY.MEAN=STATION %>% group_by(Year,Month) %>%
filter(PPT>=0.2)%>%summarise(s = mean(PPT))
This works fine but there is one month in the record (April 2007) where there were no days at all above 0.2mm and therefore this month was cut out of the output file. I want it to be included as zero even if it doesn't meet the criteria I set in the formula. Can this be done?
I hope this makes sense.