Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upJanuary is not parsed correctly #411
Comments
|
Locale problem? I had a similar issue where October and May wouldn't parse. These turned out to be the only two for which the name differed in the 3 letter abbreviation between my locale and English. |
|
here's some code I tried to replicate the issue in another locale, then I tried different thing. And clearly I do not understand the behaviour. It juste seems that it is not a simple parsing problem.
library(lubridate)
Sys.setlocale("LC_TIME", "French_France.1252")
#> [1] "French_France.1252"
vdate <- paste0(format(dmy("13/01/1973") + (0:11)*months(1), "%B"), "131973")
vdate
#> [1] "janvier131973" "février131973" "mars131973"
#> [4] "avril131973" "mai131973" "juin131973"
#> [7] "juillet131973" "août131973" "septembre131973"
#> [10] "octobre131973" "novembre131973" "décembre131973"
mdy(vdate)
#> [1] "1973-01-13" "1973-02-13" "1973-03-13" "1973-04-13" "1973-05-13"
#> [6] "1973-06-13" "1973-07-13" "1973-08-13" "1973-09-13" "1973-10-13"
#> [11] "1973-11-13" "1973-12-13"
mdy(vdate[1])
#> Warning: All formats failed to parse. No formats found.
#> [1] NA
mdy(vdate[2])
#> [1] "1973-02-13"
mdy(vdate[1:2])
#> [1] "1973-01-13" "1973-02-13"
mdy(vdate[c(1,1)])
#> Warning: All formats failed to parse. No formats found.
#> [1] NA NA
Sys.setlocale("LC_TIME", "C")
#> [1] "C"
vdate <- paste0(format(dmy("13/01/1973") + (0:11)*months(1), "%B"), "131973")
vdate
#> [1] "January131973" "February131973" "March131973"
#> [4] "April131973" "May131973" "June131973"
#> [7] "July131973" "August131973" "September131973"
#> [10] "October131973" "November131973" "December131973"
mdy(vdate)
#> [1] "1973-01-13" "1973-02-13" "1973-03-13" "1973-04-13" "1973-05-13"
#> [6] "1973-06-13" "1973-07-13" "1973-08-13" "1973-09-13" "1973-10-13"
#> [11] "1973-11-13" "1973-12-13"
mdy(vdate[1])
#> Warning: All formats failed to parse. No formats found.
#> [1] NA
mdy(vdate[2])
#> [1] "1973-02-13"
mdy(vdate[1:2])
#> [1] "1973-01-13" "1973-02-13"
mdy(vdate[c(1,1)])
#> Warning: All formats failed to parse. No formats found.
#> [1] NA NAWill continue to investigate... |
|
Playing with debugmode, I find that I think I found a problem into the regex expression stored into the environnement
It is a bit long to post here and I will try to make a gist to show you the example I made I think it may be a problem in I will try to find later. Hope this helps! |
Reported first at stacoverflow.