[R] c() with POSIXlt objects and their timezone is lost

Marc Girondot marc_grt at yahoo.fr
Mon Jun 23 23:52:07 CEST 2014

When two POSIXlt objects are combine with c(), they lost their tzone 
attribute, even if they are the same.
I don't know if it is a feature, but I don't like it !


 > es <- strptime("2010-02-03 10:20:30", format="%Y-%m-%d %H:%M:%S", 
 > es
[1] "2010-02-03 10:20:30 UTC"
 > attributes(es)
[1] "sec"   "min"   "hour"  "mday"  "mon"   "year"  "wday"  "yday" "isdst"

[1] "POSIXlt" "POSIXt"

[1] "UTC"

 > c(es, es)
[1] "2010-02-03 11:20:30 CET" "2010-02-03 11:20:30 CET"
 > attributes(c(es, es))
  [1] "sec"    "min"    "hour"   "mday"   "mon"    "year"   "wday" 
"yday"   "isdst"  "zone"   "gmtoff"

[1] "POSIXlt" "POSIXt"

[1] ""     "CET"  "CEST"

More information about the R-help mailing list