-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
dmy() Parsing of months in text failed #405
Comments
The problem may come from your locale settings. run For me, you could check this with # working
lubridate::guess_formats("1 Janv. 1987", orders = "dmy", local = "French_France.1252")
#> dmy
#> "%d %b %Y"
# not working
lubridate::guess_formats("1 Jan 1987", orders = "dmy", local = "French_France.1252")
#> NULL
#Working
lubridate::guess_formats("1 Jan 1987", orders = "dmy", local = "C")
#> dmy
#> "%d %b %Y" You could also try to see what is going on the other way around by format a date in several forms: format(lubridate::dmy("1 01 1987"), "%b@%B")
#> [1] "janv.@janvier" You could see that my abbreviated version ( You could get each abbreviation by this command (here is for french locales) format(seq.Date(as.Date('2000-01-01'), by = 'month', len = 12), "%b")
#> [1] "janv." "févr." "mars" "avr." "mai" "juin" "juil." "août"
#> [9] "sept." "oct." "nov." "déc." You could try to run these commands and see if it could be the source of the problem. And if I have your locale I may be able to help you more. By the way, I could not try it with previous version |
Thanks for the help @cderv and @vspinu, I have tried the following code on the problematic computer running v.1.5.6:
Comparing with the original computer running v.1.3.3:
I think it is unrelated to the version of lubridate. But could I set the locale before parsing the date? Not sure what would happen if I mess around with the locale there. |
Yes. You can set locale with |
@vspinu , If
It is not really a problem but just a wrong indication, at least until new feature. |
Indeed. I have just fixed that. Thanks! |
Cool, glad I could help. Should I have done a PR for that or was it ok to just tell you ? |
Either is fine. But PRs are always very much appreciated :) |
I had been using v.1.3.3 of lubridate and had no trouble running the following code:
start <- dmy("1 Jan 1987")
However on another computer running v.1.5.6 the following error was returned:
Was the parsing of textual format of months obsolete in the new version? Thanks.
The text was updated successfully, but these errors were encountered: