3
votes

Probably a stupid question, but I can't find an answer. I'm using R with xts/zoo package and have some quarterly time series data. I'm reading in the data from Excel files (I know, not ideal, but not having any problems here) and storing it in an array. I then make my time series object, essentially like this: "tsthis = xts(tmp$data, tmp$date)" where tmp is the array holding the data. This all works fine for year-month-day dates, but I can't get xts to recognize the quarterly dates, of format "1990 Q1", as dates. I'm sure there's something simple, but I've yet to find it. Obviously, I am new to R... Many thanks in advance!

1
On my machine (and very possibly yours) the answer is here: 127.0.0.1:28645/library/zoo/html/yearqtr.htmlIRTFM

1 Answers

5
votes

Make your index with:

?yearqtr
as.yearqtr(tmp$date) # will automagically try "%Y Q%q", "%Y q%q" or "%Y-%q"