Rajarshi Bhadra
Rajarshi Bhadra

Reputation: 1944

Dygraphs in R with numeric x axis

My question is with reference to this issue here.Seeing that dygraph now supports numeric x axis I tried to test a data with numeric x axis however it gave an error. The code that I used is

 dygraph(as.data.frame(x = 1:10, y = runif(10))) %>%
  dyAxis("y", valueRange = c(0, 1.5)) %>%
  dyEvent(2, label = "test") %>%
  dyAnnotation(5, text = "A")

Error in as.POSIXlt.character(x, tz, ...) : 
  character string is not in a standard unambiguous format

Upvotes: 1

Views: 882

Answers (1)

MLavoie
MLavoie

Reputation: 9886

you were very close; replace as.data.frame with data.frame

 dygraph(data.frame(x = 1:10, y = runif(10))) %>%
  dyAxis("y", valueRange = c(0, 1.5)) %>%
  dyEvent(2, label = "test") %>%
  dyAnnotation(5, text = "A")

Upvotes: 2

Related Questions