opt opt - 12 days ago 6
R Question

R xts pkg and quarterly data

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!

42- 42-
Answer

Make your index with:

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