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

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu May 11 12:13:48 CEST 2023


В Thu, 11 May 2023 17:51:33 +0800
Jinsong Zhao <jszhao using yeah.net> пишет:

> Both codes do not return NA on FreeBSD:
> 
>  > strptime("1970-01-01 00:00.00 UTC", "%Y-%m-%d %H:%M", '')  
> [1] "1970-01-01 CST"
>  > strptime("1970-01-01 00:00.00 UTC", "%Y-%m-%d", '')  
> [1] "1970-01-01 CST"

I must have misread the code of as.POSIXlt.character then.

> I do not know how to use R's debugger...

In short, debugonce(as.POSIXlt.character) will prepare R to start the
debugger once the function is called. The debugger prompt is described
in ?browser; it's mostly like R's prompt (you can call print(variable)
and other, more complicated expressions), but there are special
commands like "n" (next statement), "s" (step inside the function call)
and so on.

Call:

debugonce(as.POSIXlt.character)
as.POSIXct("1970-01-01 00:00.00 UTC")

Use n to step over function calls and s to step inside for loops. See
what's returned by strptime() calls inside this function. It's raising
an exception because all of them contain NAs somewhere; which element is
NA? What are the exact arguments used to call strptime()?

This doesn't seem to be due to differences in locale: both CentOS and
FreeBSD use en_US.UTF-8.

-- 
Best regards,
Ivan



More information about the R-help mailing list