I have data frame as shown below:
str(Rainfall_Complete)
'data.frame': 8221 obs. of 18 variables:
$ Date : Date, format: "1985-04-29" "1985-04-30" "1985-05-01" ...
$ Month : Ord.factor w/ 12 levels "Jan"<"Feb"<"Mar"<..:
$ Season : Factor w/ 4 levels "Monsoon","PostMonsoon",..:.
$ Year : chr "1985" "1985" "1985" "1985" ...
$ Stn A : num 0 8.8 0 15 26.2 0 2.5 0 0 0 ...
$ Stn B : num 0 0 26 11 13.8 20 0.26 0 0 0 ...
$ Stn C : num 0.1 0 0 0 13.5 27 16 5 0 0 …
I want to convert the above daily time series to monthly time series I want my data to look something like this
Year Month StnA StnB StnC……..
1985 Jan 150 100 120
1985 Feb 120 98 58
….
2010 Jan 200 100 87
2010 Feb 140 145 120
I tried the following, however it works only for univariate series
library(dplyr)
Monthly_rainfall <- Rainfall_Complete %>% group_by(Year,Month)%>% summarise()
Any help would be appreciated