有一些奇怪的行为dygraph
.
使用for
循环时,dygraph
我没有结果.
library(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths)
for(i in 1:2){
dygraph(lungDeaths[, i])
}
Run Code Online (Sandbox Code Playgroud)
另一方面,当我使用lapply
我确实得到预期的结果
lapply(1:2, function(i) dygraph(lungDeaths[, i]))
Run Code Online (Sandbox Code Playgroud)
我实际上想在我自己的数据集中使用for
循环R Markdown
并迭代不同的列,但即使我使用lapply
"解决方法",它也不会绘制dygraphs
R Markdown代码
---
title: "Untitled"
author: "dimitris_ps"
date: "28 May 2015"
output: html_document
---
```{r}
library(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths)
lapply(1:2, function(i) dygraph(lungDeaths[, i]))
```
Run Code Online (Sandbox Code Playgroud)
而当我逐列运行它时,它的工作原理
---
title: "Untitled"
author: "dimitris_ps"
date: "28 May 2015"
output: html_document
---
```{r echo=FALSE}
library(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths) …
Run Code Online (Sandbox Code Playgroud) 我正在运行以下 RSTUDIO 帮助页面提供的 dygraph 示例。
http://rstudio.github.io/dygraphs/gallery-synchronization.html
当我运行以下代码时,我会分别获得每个 dygraph 的单独图。
dygraph(ldeaths, main = "All", group = "lung-deaths")
dygraph(mdeaths, main = "Male", group = "lung-deaths")
dygraph(fdeaths, main = "Female", group = "lung-deaths")
Run Code Online (Sandbox Code Playgroud)
我没有得到帮助页面中显示的同步图。"group" 变量 "lung-deaths" 不是 xts 对象的一部分。如果我在这里遗漏了一些基本的东西,请告诉我。
谢谢
普拉迪普
我正在尝试将多个 dygraph 绘图放在 Flexdashboard 的单个选项卡上。我从这里和这里尝试了很多不同的选择
\n\n我的 RMD 文件如下所示:
\n\n ---\n title: "Project Dashboard"\n output: \n flexdashboard::flex_dashboard:\n orientation: columns\n vertical_layout: scroll\n ---\n # Intro {.sidebar}\n\n # Page 1\n\n ## Column 1 {.tabset .tabset-fade data-width=850}\n\n ### Site 1\n\n ```{r Data, echo=FALSE, fig.height=2}\n\n s <- dygraph(as.xts(df,order.by=df$DateTime), group = "NC") %>% \n dyOptions(drawPoints = TRUE, pointSize = 1) %>%\n dyAxis("y", label = "Salinity (PSU)", valueRange = c(16, 30)) %>%\n dyRangeSelector(height = 20) %>% \n dyLegend(width = 400)\n\n t <- …
Run Code Online (Sandbox Code Playgroud) 取自这个问题,我想知道如何以dy_graph
闪亮的方式显示列表对象。下面的一段代码创建了它,但我不是 html 专家,阅读htmltools
手册没有帮助。基本上我需要修改这部分htmltools::browsable(htmltools::tagList(dy_graph))
以在 Shiny 中渲染。
# create the time series
temperature <- ts(frequency = 12, start = c(1980, 1),
data = c(7.0, 6.9, 9.5, 14.5, 18.2, 21.5,
25.2, 26.5, 23.3, 18.3, 13.9, 9.6))
rainfall <- ts(frequency = 12, start = c(1980, 1),
data = c(49.9, 71.5, 106.4, 129.2, 144.0, 176.0,
135.6, 148.5, 216.4, 194.1, 95.6, 54.4))
# create a list of dygraphs objects
library(dygraphs)
library(htmltools)
dy_graph <- list(
dygraphs::dygraph(temperature, group="temp_rain", main="temperature"),
dygraphs::dygraph(rainfall, …
Run Code Online (Sandbox Code Playgroud) 我试图在不同的面板中绘制动态图,因为它可以在网站上使用,group
例如
但它应该是动态的使用dygraphs.这里的示例代码:
library(quantmod)
library(dygraphs)
data(edhec)
R = edhec[, 1:4]
dygraph(R)
Run Code Online (Sandbox Code Playgroud)
提前谢谢了.