tidyquant
tidyquant copied to clipboard
zoo index not recognized as POSIXct/datetime
I have a zoo object with a POSIXct index. When I try to zoom, it seems the x-values (zoo object's Index) are not recognized as a POSIXct class:
> dzoo <- as.zoo(dxts)
> candles<-tail(dzoo, nlast)
> pl <- ggplot(candles, aes(x=Index)) +
+ geom_point(aes(y=avg), cex=0.2) +
+ geom_barchart(aes(open=open, high=high, low=low, close=close),
+ color_up="green", color_down="red") +
+ theme_tq()
> pl + coord_x_datetime(xlim=c(start, end))
Error in as.POSIXct.default(x) :
do not know how to convert 'x' to class “POSIXct”
> class(index(candles))
[1] "POSIXct" "POSIXt"
What am I missing?
Please provided a reproducible example with all code necessary to generate the issue. I can't recreate your issue currently.
please see code above... Any dzoo data with an open
, close
, high
, low
and avg
field and time index will do. If that's not sufficient, ofc I can just add some random data.
@kurt-o-sys you need to supply the dxts
object so we can run your code. Can you give us the output from datapasta::tribble_paste(dxts)
(even if it is a small number of rows)?
I provided an example in https://github.com/business-science/tidyquant/issues/78 My guess is that these two issues can be merged.