首页 > 解决方案 > 作为交互式仪表板滑入 R

问题描述

在 R 演示文稿中是否不可能有一张幻灯片,比如 ioslides,这是一个交互式仪表板?在 Rstudio 中,flexdashboard 必须作为不同的文件打开,并且 Shiny 仪表板不会在幻灯片演示中运行。谢谢

标签: rshinyflexdashboard

解决方案


您可以runtime: shiny在文档的标题中使用。

---
output: ioslides_presentation
runtime: shiny
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

## Slide {.smaller}

### Here are two Shiny widgets

```{r echo = FALSE}
selectInput("n_breaks", label = "Number of bins:",
              choices = c(10, 20, 35, 50), selected = 20)

```

### ...that build a histogram.

```{r echo = FALSE}
renderPlot({
  hist(faithful$eruptions, probability = TRUE, 
       breaks = as.numeric(input$n_breaks),
       xlab = "Duration (minutes)", 
       main = "Geyser eruption duration")
})
```

结果是一张带有交互式的幻灯片selectInput,允许更改直方图的中断:

在此处输入图像描述

您可以在此处找到更多详细信息:https ://shiny.rstudio.com/articles/interactive-docs.html


推荐阅读