将参数添加到dygraph

时间:2016-05-22 05:43:30

标签: r dygraphs

我正在尝试更改显示的dygraph中的小数点后的数字,但是我收到此错误:

Error in dygraph(indoConc, { : object 'digitsAfterDecimal' not found

代码

library(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths)

indoConc <- Indometh[Indometh$Subject == 1, c("time", "conc")]
dygraph(indoConc,{digitsAfterDecimal:1})

Dygraph链接到部分:here

2 个答案:

答案 0 :(得分:1)

试试这个:

dygraph(indoConc) %>% dyOptions(digitsAfterDecimal=1)

有关更多选项,请参阅http://finzi.psych.upenn.edu/library/dygraphs/html/dyOptions.html

答案 1 :(得分:0)

另一种方法是设置sigFigs选项,因为尾随零不会显示为digitsAfterDecimal,它取决于您的数据。

dygraph(indoConc) %>%
dyOptions(sigFigs=1)

此外,您似乎将Java脚本与R中用于dygraph的R代码混淆。以下是R包文档的dygraph的链接:https://cran.r-project.org/web/packages/dygraphs/dygraphs.pdf