xts icon indicating copy to clipboard operation
xts copied to clipboard

plot.xts fails if index is POSIXlt with 3-element tzone

Open joshuaulrich opened this issue 8 years ago • 0 comments

As documented in ?DateTimeClasses:

"POSIXlt" objects will often have an attribute "tzone", a character vector of length 3 giving the time zone name from the TZ environment variable and the names of the base time zone and the alternate (daylight-saving) time zone. Sometimes this may just be of length one, giving the time zone name.

plot.xts currently fails if you call it on an xts object with a 3-element tzone attribute.

tz3 <- c("","CST","CDT")
x <- xts(1:10, as.POSIXlt(Sys.Date()-10:1, tz=tz3), tzone=tz3)
plot(x)
# Error in as.POSIXlt.POSIXct(.POSIXct(.index(x)), tz = indexTZ(x)) : 
#   invalid 'tz' value

joshuaulrich avatar Apr 04 '17 12:04 joshuaulrich