[R] Representing 'Date' as 'Year - Quarter'

From: Vishal Belsare <vishal.belsare_at_gmail.com>
Date: Sat, 31 May 2008 14:09:02 +0530

I have financial data on a a set of firms, with a quarterly period (fundamental data). The data spans 10 years, and four quarters per year. The present file (.csv) reads the Date columns as "200706" for the second quarter of 2007; "199809" for the third quarter of 1997.

Is there a way I can convert it to something like "2007 Q2", "1998 Q3"?

I am aware of the yearqtr feature of the zoo package and ts also has some facility to represent frequency.

However, the problem is that, my data isn't exactly a time series right now. In each quarterly file, the date column has the same value f.e 200706, however each row contains fundamental data of a different firm.

Ultimately, I intend to aggregate the 40 or so files into one data frame.

So is it possible to read off the 199806 as a 'date' variable, with a quarterly frequency? The reason why I am keen on this is that I can then shape my further sub-setting in a form like which(... date == "1998 Q2") or so instead of forcing myself to write "1998/06/30" which would indicate end of second quarter (I just think that is redundant).

Thanks in anticipation.

Best Regards

Vishal Belsare

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 02 Jun 2008 - 02:57:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 02 Jun 2008 - 04:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive