How to input quarterly data in R

Viewed 1722

I have panel of quarterly data which looks like this:

x <- c("Q1 2013","Q2 2013", "Q3 2013", "Q4 2013")      

How can I be able to properly input this data into r as quarterly time series date so I would be able to perform analysis on it?

I tried to use yearqtr from zoo package but all I receive is NA.

as.Date(as.yearqtr(x, format = "Q%q /%yyyy"))    

This could be because of the space between Q1 and 2013, I'm open to change my format if I have to but I'm not even sure what format would work in R. Should I change my columns to 1.2013, 2.2013, ... or this would also not be recognized as a date format by R? And how am I gonna be able to change them when I have a repeated sample of quarterly date in this format: Q1 2013, etc.

1 Answers
Related