0

I would like to turn a character variable formatted as YYYY-QQ, so for example 2010-Q1, into something I can use as a date. I have played around with as.yearqtr, but haven't could only figure out the output format. I haven't been been able to define the input format though.

Edit:

Has also been answered here.

JotHa
  • 55
  • 7

1 Answers1

1

You have to use the right format in as.yearqtr formula like this:

library(zoo)
x<-"2010-Q1"
as.yearqtr(x, format = "%Y-Q%q")
[1] "2010 Q1"
Terru_theTerror
  • 4,918
  • 2
  • 20
  • 39