简体   繁体   中英

Is it possible to embed a shiny app hosted online into an R-Markdown document?

I am looking for a way to include an interactive shiny app in an R-Markdown .html document that I can share with colleagues. Unfortunately, most of these colleagues are not r-savvy, so running the Markdown script themselves is a no-go. I know shiny needs a host machine to run the code in the background, so simply saving the generated .html does not work. But is it possible to, say, deploy the shiny app on shinyapps.io, and somehow embed the url into the R-Markdown document so when the document is opened, it connects automatically to the shinyapps.io link, and displays the app running on the shinyapps server?

You can create a html document containing link to your app. An iframe is used to display a webpage in the main one. Create a file app.html and write inside:

<iframe src="https://www.shinyapps.io/" height="100%" width="100%" scrolling="no" title="Iframe Example"></iframe>

Or in rmarkdown ( documentation ) use:

```{r, out.width =  "100%"}
knitr::include_app("https://www.shinyapps.io")
```

Thanks to @Stéphane Laurent

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM