[Rd] Bug in julian() (PR#1332)
ripley@stats.ox.ac.uk
ripley@stats.ox.ac.uk
Thu, 28 Feb 2002 11:12:38 +0100 (MET)
These are work correctly on my Windows 2000 and XP systems. That means the
bug must be in your Windows system if as I presume you are using the
binaries from CRAN. Have you tried the advice in the rw-FAQ about trying
another msvcrt.dll? That has solved a couple of the time-related problems.
On Thu, 28 Feb 2002 Michael.Jacob@bruker-axs.de wrote:
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._