0

I am trying to convert a character string to date in R.

string <- "August2018"

as.Date(x = string, format = "%B%Y")

The following code gives me only NA :(

From the documentation, %B is the full month name in the current locale and %Y is Year with century (4 digit year).

https://stat.ethz.ch/R-manual/R-devel/library/base/html/strptime.html

I also tried to set my locale to "en_US.UTF-8" with the code: Sys.getlocale (category = "LC_ALL"). This did not help either.

Can somebody please help me what I am doing wrong?

0 Answers0