Search code examples
rdygraphs

How could I draw a function by dygraphs package in R?


  1. I have a R plot like plot(t<-1:1000,log(t)),
  2. How could I draw a function by dygraph in R? I have tried dygraph(log(t)), but the"dygraph" function only accept the xts object(Time series data), how could I use the dygraph function to draw a non-Time series data?

Solution

  • If you really wanted to plot log(t) using dygraphs package (even though it is especially made for time series), you could do the following:

    library(dygraphs)
    x <- log(t)
    time.series.x <- ts(x)
    dygraph(time.series.x)