是否可以在情节提要flexdashboard中嵌入面向行的flexdashboard?

时间:2019-07-08 22:00:54

标签: r flexdashboard

我有以下2个仪表板。我想将面向行的仪表板包括在情节提要仪表板中。

行式Flexdasboard

---
title: "Row-Oriented"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    theme: united
---

```{r setup, include=FALSE}
library(flexdashboard)
library(crosstalk)


# Making the data shared
sd <- SharedData$new(mtcars)
```

Inputs {.sidebar}
-----------------------------------------------------------------------
```{r}
# select cylinder range
filter_slider(id = "cylinder", label = "Num. of cyl", sharedData = sd, column = ~cyl)

# select hp range
filter_slider(id = "hp", label = "Horsepower", sharedData = sd, column = ~hp)
```

Row {data-height=550}
-------------------------------------
###
```{r}
library(plotly)

plot_ly(data = sd, x = ~disp, y = ~mpg) %>% 
  add_markers(color = ~cyl) %>% 
  layout(title = "disp vs mpg, Color = Cyl")
```

###
```{r}
library(plotly)

plot_ly(data = sd, x = ~disp, y = ~mpg) %>% 
  add_markers(color = ~hp) %>% 
  layout(title = "disp vs mpg, Color = hp")
```

Row {data-height=550}
-------------------------------------
###
```{r}
library(plotly)

plot_ly(data = sd, x = ~drat, y = ~qsec) %>% 
  add_markers(color = ~cyl) %>% 
  layout(title = "drat vs qsec, Color = Cyl")
```

###
```{r}
library(plotly)

plot_ly(data = sd, x = ~drat, y = ~qsec) %>% 
  add_markers(color = ~hp) %>% 
  layout(title = "drat vs qsec, Color = hp")
```  

故事板仪表板

---
title: "Storyboard"
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    theme: united
    social: menu
    source: embed
---

```{r setup, include=FALSE}
library(flexdashboard)

# Load data
data("mtcars")
```

### Row Oriented Dashboard Placeholder
```{r, echo=FALSE, include = FALSE}
htmltools::includeHTML("row_oriented_flexdashboard.html")
```


### Second part 

```{r}
library(ggplot2)

ggplot(data = mtcars, aes(x = disp, y = mpg)) +
  geom_point(aes(color = gear))
```

问题:

如果我在情节提要面板的include = FALSE部分执行了### Row Oriented Dashboard Placeholder,则它将正确呈现(只有第一部分为空)。但是,如果include = TRUE,则不会呈现面向行的仪表板。

  

如何将行式仪表板的HTML文件成功嵌入到情节提要仪表板中?

     

进行此嵌入的主要原因是,情节提要中没有Inputs选项。如果有要添加的内容,请告诉我。然后,我将所有代码块都包括在情节提要中。

0 个答案:

没有答案