[R] how to retain time zone when doing c(POSIXct)
Sebastian P. Luque
spluque at gmail.com
Wed Sep 27 22:12:38 CEST 2006
Hello,
What is the best way to concatenate POSIXct objects keeping the time zone
attribute in a program? For example:
R> xx <- as.POSIXct(strptime(c("2006-09-26 12:00:00", "2006-09-26 13:00:00"),
+ format="%Y-%m-%d %H:%M:%S"), tz="GMT")
R> xx
[1] "2006-09-26 12:00:00 GMT" "2006-09-26 13:00:00 GMT"
but, as ?c.POSIXct explains:
R> c(xx, xx[1] - 60, xx[2] + 60)
[1] "2006-09-26 07:00:00 CDT" "2006-09-26 08:00:00 CDT"
[3] "2006-09-26 06:59:00 CDT" "2006-09-26 08:01:00 CDT"
Is there something better/safer than simply setting the "tzone" attribute
of the new object?
Cheers,
--
Seb
More information about the R-help
mailing list