当“日期”列缺少行时,有人知道如何防止R音谱连接分离的点吗?
我尝试将connectSeparatedPoints
参数设置为FALSE
,但是它不起作用。
library(dygraph)
table_test <- data.table(date = as.Date(c("2018-01-01","2018-01-02","2018-01-03","2018-01-10","2018-01-11")),
value = c(5,6,4,7,8))
dygraph(table_test) %>% dyOptions(connectSeparatedPoints = F)
非常感谢!
答案 0 :(得分:0)
添加至少一个缺失值(NA)即可。无需使用选项 connectSeparatedPoints 。 以 date = 2018-01-04和 value = NA:
表示差距的示例library(dygraph); library(data.table)
table_test <- data.table(date =
as.Date(c("2018-01-01","2018-01-02","2018-01-03","2018-01-04","2018-01-10","2018-01-11")),
value = c(5,6,4,NA,7,8))
dygraph(table_test)