[R] Error in as.POSIXlt.character(x, tz, ...)

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu May 11 11:22:18 CEST 2023

В Thu, 11 May 2023 16:56:41 +0800
Jinsong Zhao <jszhao using yeah.net> пишет:

> When I run the following code in R 4.3.0 on FreeBSD, I got error.
>  > as.POSIXct("1970-01-01 00:00.00 UTC")  
> Error in as.POSIXlt.character(x, tz, ...) :
>    character string is not in a standard unambiguous format

Do strptime("1970-01-01 00:00.00 UTC", "%Y-%m-%d %H:%M", '') and
strptime("1970-01-01 00:00.00 UTC", "%Y-%m-%d", '') both return NA for
you on FreeBSD? If not, can you trace the execution using R's debugger
to see which parts are returned as NA, failing the test in

I think that strptime() should have discarded the trailing parts of the
string and matched at least the beginning (though not the ".00 UTC"
part because it doesn't correspond to the formats tried by strptime()).
Moreover, there shouldn't be significant difference between the
platforms, because R seems to always use an internal implementation of
strptime(). Are you using a multi-byte locale? (What's your
sessionInfo() on both a system where it works and the system where it

Best regards,

More information about the R-help mailing list