[R] Unexpected date format coercion

Jeremie Juste jerem|eju@te @end|ng |rom gm@||@com
Thu Jul 1 10:06:00 CEST 2021


Hello,

I have been surprised when converting a character string to a date with the following
format,

in R 4.1.0 (linux debian 10)

as.Date("20-12-2020","%Y-%m-%d")
[1] "20-12-20"

in R 4.0.5 (window 10)

as.Date("20-12-2020","%Y-%m-%d")
[1] "0020-12-20"


Here I was expecting a blunt and sharp NA, am I missing something?

Best regards,
Jeremie



More information about the R-help mailing list