Time series, change monthly data to quarterly

date, r, time-series

Solution

 monthly <- ts(mydata, start = c(1990, 1), frequency = 12)
 quarterly <- aggregate(monthly, nfrequency = 4)

Problem

Now I have some monthly data like : ``` 1/1/90 620 2/1/90,591 3/1/90,574 4/1/90,542 5/1/90,534 6/1/90,545 #...etc ``` If I use ts() function, it's easy to make the data into time series structure like: ``` Jan Feb Mar ... Nov Dec 1990 620 591 574 ... 493 464 1991 100 200 300 ........... ``` Is there any possibilities to change it into quarterly repeating like this: ``` 1st 2nd 3rd 4th 1990-Q1 620 591 574 464 1990-Q2 100 200 300 400 1990-Q3 ... 1990-Q4 ... 1991-Q1 ... ``` I tried to change ``` ts(mydata,start=c(1990,1),frequency=12) ``` to ``` ts(mydata,start=c(as.yearqrt("1990-1",1)),frequency=4) ``` but it seems not working. Could anyone help me? Thank you very much.

Original source