是不可能在R演示文稿中有一张幻灯片,比如ioslides,这是一个交互式仪表板?在Rstudio中,flexdashboard必须作为不同的文件打开,而Shiny仪表板不会在幻灯片演示文稿中运行。谢谢
答案 0 :(得分:2)
您可以在文档的标题中使用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