Problems locale language with converting string to dates

51 views Asked by At

I have problems with converting strings into dates. First I encountered the problem and figured out that as.chron is using the Dutch abbrevations. Therefore I thought that changing the locale would solve this problem. However after doing this I still have the same problem and I can not figure out where to adjust the language as.chron uses.

Input

require("chron")
Sys.setlocale(category = "LC_ALL", locale = "English")
as.chron("Mrt 12, 2015", format = "%b %e, %Y") #The dutch abbrevation
as.chron("Mar 12, 2015", format = "%b %e, %Y")

Output

Sys.setlocale("LC_ALL","English")
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United         States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"
> as.chron("Mrt 12, 2015", format = "%b %e, %Y")
[1] (03/12/15 00:00:00)
> as.chron("Mar 12, 2015", format = "%b %e, %Y") 
[1] (NA NA)
1

There are 1 answers

0
Twan Houwers On BEST ANSWER

Solved it by restarting Rstudio..