I am trying to convert string variables written as "Mon-YY" into the date class using as.Date, but I am getting a string of NAs. I used the following code:
cal_month = c("Feb-12", "Mar-12", "Apr-12", "May-12", "Jun-12", "Jul-12", "Aug-12", "Sep-12", "Oct-12")
test_Date = as.Date(cal_month, "%b-%y")
I got the following output for test_Date:
NA NA NA NA NA NA NA NA NA
I saw that there was some previous discussion about setting my C locale, so I did the following, but it made no difference. I got the exact same output as above.
lct <- Sys.getlocale("LC_TIME"); Sys.setlocale("LC_TIME", "C")
cal_month = c("Feb-12", "Mar-12", "Apr-12", "May-12", "Jun-12", "Jul-12", "Aug-12", "Sep-12", "Oct-12")
test_Date = as.Date(cal_month, "%b-%y")
Sys.setlocale("LC_TIME", lct)