On 23.06.2014 23:52, Marc Girondot wrote:
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 !

Marc

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

$class
[1] "POSIXlt" "POSIXt"

$tzone
[1] "UTC"

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

$class
[1] "POSIXlt" "POSIXt"

$tzone
[1] ""     "CET"  "CEST"




From ?c:

"c is sometimes used for its side effect of removing attributes [...]"

and from ?c.POSIXlt:


"Using c on "POSIXlt" objects converts them to the current time zone, [...]"

Best,
Uwe Ligges



______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to