[英]How to make an interactive isoslides presentation using Shiny and Rmarkdown?
当我在.Rmd
文件中制作Shiny
应用程序以制作isoslides
演示时,该应用程序的“行为”类似于静态html
页面(无法进行交互)。
例如, Rmd
文件中的以下代码将生成一个您无法交互使用的静态html
演示文稿。
---
output: ioslides_presentation
---
## Useless App
```{r echo=FALSE, message=FALSE, warning=FALSE}
library(shiny)
ui = fluidPage(
numericInput("n", "How old are you?", value = 1)
)
server = function(input, output, session) {
}
shinyApp(ui, server)
我错过了什么?
不幸的是,你不能这样做。
最接近的方法是将闪亮的应用程序部署到某个地址,无论是在网络上还是在本地,然后使用 iframe 将其嵌入到幻灯片中。
例如:
---
output: ioslides_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Slide with plot
```{r}
plot(cars)
```
## Slide with Shiny app in iframe
<iframe width = "560" height = "315" src="https://nsgrantham.shinyapps.io/tidytuesdayrocks/"></iframe>
如果您想使用本地应用程序执行此操作,您可以在单独的 R 会话中部署您的应用程序,然后从浏览器中获取本地地址(例如:http: //111.0.0.1 :1234/ 并将其粘贴为iframe 源码。
上面的答案是不准确的。
对于您的 YAML 标头
---
output: ioslides_presentation
runtime: shiny
---
嵌入闪亮的应用程序(假设它是一个单独的文件):
```{r, echo = FALSE, message=F, warning=FALSE}
shinyAppFile(
"FileMyAppIsIn/app.R",
options = list(width = "100%", height = 700)
)
``
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.