I want to adjust a column to use it as a date variable in a chart. However the variable contains Roman numerals as month and on the other hand a year displayed in Arabic numerals.
Factor w/ 34 levels "I-III 2010","I-III 2011",..
I'd like to transform these values into the following pattern (year-quarter ): 2010-1 , 2011-1.
I tried the following, but not sure if it's the best way to approach my problem.
df$var = gsub("I-III", "1 -", df$var)
df$var = gsub("IV-VI", "2 -", df$var)
df$var = gsub("VII-IX","3 -", df$var)
df$var = gsub("X-XII","4 -", df$var)
What would you recommend?
Thanks