[Rd] base::as.Date inconsistency/bug

From: Andreas Eckner <andreas_at_eckner.com>
Date: Mon, 08 Nov 2010 17:47:31 -0500


ink1">Dear all,  

I would like point out a potential bug (or at least inconsistency) in the way the R base package converts numeric numbers to dates. Specifically, consider the following two calls:  

> as.Date(0.5, origin="1969-12-31")

[1] "1970-01-01"
> as.Date(0.5, origin="1970-01-01")

[1] "1970-01-01"  

As you can see, both calls produce the same output on the screen. Curiously, the output is NOT the same for other consecutive origins:  

> as.Date(0.5, origin="2009-12-31")

[1] "2009-12-31"
> as.Date(0.5, origin="2010-01-01")

[1] "2010-01-01"  

Best regards,
Andreas Eckner    



> sessionInfo()

R version 2.11.0 (2010-04-22)
i386-pc-mingw32  

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252  

attached base packages:
[1] stats graphics grDevices utils datasets methods base

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 09 Nov 2010 - 09:28:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 09 Nov 2010 - 16:00:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive