[Rd] as.Date function yields inconsistent results (PR#14166)

From: <diverses_at_univecom.ch>
Date: Tue, 22 Dec 2009 20:40:12 +0100 (CET)

Full_Name: Mario Luoni
Version: 2.10.0
OS: Windows XP HE SP3
Submission from: (NULL) (

This piece of code:

zzz1 <- as.POSIXct("1999-03-18", tz="CET") zzz2 <- as.POSIXlt("1999-03-18", tz="CET") zzz1 == zzz2

yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are different:

> as.Date(zzz1)
[1] "1999-03-17"

> as.Date(zzz2)
[1] "1999-03-18"

For me this looks like a bug, even though it could be a problem with timezones, but I couldn't find documentation that would explain that behaviour.

> sessionInfo()
R version 2.10.0 (2009-10-26)

[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] grDevices datasets splines graphics stats tcltk utils
methods base

other attached packages:
[1] svSocket_0.9-48 TinnR_1.0.3 R2HTML_1.59-1 Hmisc_3.7-0

loaded via a namespace (and not attached):
[1] cluster_1.12.1 grid_2.10.0 lattice_0.17-26 svMisc_0.9-56 tools_2.10.0

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 23 Dec 2009 - 12:37:01 GMT

This archive was generated by hypermail 2.2.0 : Mon 28 Dec 2009 - 10:11:16 GMT