I'm trying to parse a vector tsl
into a date class.
tsl <- c("Dec-2011", "Dec-2011", "Dec-2011", "Dec-2011", "Dec-2011",
"Dec-2011")
I read the documentation of as.Date
and I thought that as.Date(tsl, "%b-Y")
should do the job, but it returns NAs.
I've also tried the following:
as.Date(tsl, "bbb-YYYY")
as.Date(tsl, "by")
Then I tried using lubridate
but this didn't work either:
library(lubridate)
parse_date_time(tsl, "%b-%y")
Running Sys.getlocale()
returns:
"LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252"
Any ideas how to solve it?