Closed timelyportfolio closed 9 years ago
As this progresses, we can probably leverage more deeply all the work done with time by @jjallaire with dygraphs
.
xts
only has a dependency on zoo
, so it's not exactly a heavyweight dependency (I mean, ggplot2
depends on plyr
which is super-heavyweight since it depends on Rcpp
).
For:
index(spy) <- as.POSIXct(index(spy))
tauchart(spy) %>% tau_point("Date","SPY.Close") %>% tau_guide_x( tick_format = "%Y")
I'm getting:
Error in as.POSIXct.default(x, tz = "GMT") :
do not know how to convert 'x' to class “POSIXct”
Actually, I think I can avoid the dependency on xts
entirely. Let me rework the code a bit. See #11
I'm not sure on the as.POSIXct
. Is class(index(spy)) == "Date"
before attempting the conversion? It is not really important. I was just showing that it handles both Date
and POSIXct
.
This is very much up for discussion. I borrowed some code from
dygraphs
to convertDate
/POSIXct
to ISO8601 format, whichtauCharts
accepts. In addition, if data isxts
then it will convert to adata.frame
with a columnDate
for theindex
. I have not tested this on all the various complicated date types inR
, but at least it is a start.Question: is a dependency on
xts
ok since this will only be useful for a subset of folks? We could instead still handle the date conversion but require axts
user to convert to an appropriatedata.frame
.