R 中带有数字 x 轴的 Dygraphs

Dygraphs in R with numeric x axis

我的问题是关于这个问题 here。看到 dygraph 现在支持数字 x 轴,我试图用数字 x 轴测试一个数据,但是它给出了一个错误。我使用的代码是

 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

你们非常亲密;将 as.data.frame 替换为 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")