I'm trying to use as.Date with some data, but I encounter NAs with specific months. I created a data.frame named Fake to test it, and it gave me the same error : it works with September but not with August.
Fake <- c("Sep 12 2014", "Aug 12 2014")
as.Date(Fake, format ="%b %d %Y")
This is what I get:
> as.Date(Fake, format ="%b %d %Y")
[1] "2014-09-12" NA
I need to use June data also but it doesn't work, even if July data does. Anyone can help?
The issue is that you have a French locale, which uses different month and day names and abbreviations. You can change to the English locale by running:
Sys.setlocale('LC_ALL','en_CA.utf-8');
Edit: You might also/instead have to run this (I've found this to be necessary in RStudio):
Sys.setlocale('LC_ALL','English');
References that might be useful to people:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With