I have a daily time series data and wish to construct a daily moving average and create a quarterly data frame. As an example the first data set (of the example data) should include daily data for the months January, February and March, while the second series should be February, March and April. Similarly, the last data set should be that of October, November and December. I wish to do this for the variables “tmpd, pm10median and so2median” in the sample data. How can I achieve this?
library(gamair)
data(chicago)
chicago$date<-seq(from=as.Date("1987-01-01"), to=as.Date("2000-12-31"),length=5114)
data<- chicago[,c("date","tmpd", "pm10median", "so2median" )]
Using
xtspackage , you can do something like thisTo show some rows:
UPDATE
It looks that the OP wants to split the Moving average series by quarter.