В Thu, 11 May 2023 17:51:33 +0800 Jinsong Zhao <jsz...@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 ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.