This is a rope. Don't push it. Been there, been swatted.

The current structure of R cannot support vectors of POSIXt timestamps that have different tzones in different elements. You can keep a parallel vector of tzones separately and manage environment variable TZ as needed if you really must handle each timestamp in a different time zone.

By the way, count yourself lucky that c() works with POSIXlt at all, since POSIXlt is a list of vectors. My practice is to store data in POSIXct pretty much exclusively, reserving POSIXlt for temporary time manipulations only.

On Mon, 23 Jun 2014, 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"

______________________________________________
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.


---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k

______________________________________________
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