From Michael.Jacob@bruker-axs.de  Thu Feb 28 09:57:42 2002
From: Michael.Jacob@bruker-axs.de (Michael.Jacob@bruker-axs.de)
Date: Thu, 28 Feb 2002 10:57:42 +0100 (MET)
Subject: [Rd] Bug in julian() (PR#1332)
Message-ID: <200202280957.KAA04663@pubhealth.ku.dk>

Full_Name: Michael Jacob
Version: 1.4.1
OS: Windows 2000 SP2
Submission from: (NULL) (195.27.237.226)


Hi,

there seems to be a bug in julian():

> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=English_United States.1252"
> julian(Sys.time())
Error in fromchar(x) : character string is not in a standard unambiguous format
> julian
function (x, ...) 
UseMethod("julian")
> julian.POSIXt
function (x, origin = as.POSIXct("1970-01-01", tz = "GMT"), ...) 
{
    if (length(origin) != 1) 
        stop("`origin' must be of length one")
    res <- difftime(as.POSIXct(x), origin, units = "days")
    structure(res, origin = origin)
}
> as.POSIXct("1970-01-01", tz = "GMT")
Error in fromchar(x) : character string is not in a standard unambiguous format
> as.POSIXct("1970-01-01 00:00:00", tz = "GMT")
Error in fromchar(x) : character string is not in a standard unambiguous format
> as.POSIXct("1970-01-01 01:00:00", tz = "GMT")
[1] "1970-01-01 02:00:00 W. Europe Standard Time"
> 

The problem is, that as.POSIXct() does not parse the default argument to
julian() correctly. It seems to set is.na() to TRUE, whenever the hour is
missing or equal to zero.

Best Regards

Michael

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Bug in julian() (PR#1332)
Michael.Jacob@bruker-axs.de