How to embed a shiny app in an Rmarkdown html document
I would like to create an html document with RMarkdown containing text, Rcode and somewhere in between a brilliant app.
- I thought to use
asis=TRUE
for a blockshinyApp(ui, server)
, but RStudio only displays the Rmd file if I addruntime: shiny
in the YAML header. - If I do this, no html is generated, but I can go to the browser view.
- If I look at the source code in the browser view, I still can't see the entire HTML.
- If I check the generated temp file, I could not find the html file representing the entire RMarkdown document.
How to generate html code from shinyApp function? Or: how to generate an html file, from RMarkdown containing a brilliant application, not, for example, a plot
Hope you have an idea for me.
source to share
I really don't understand what you mean by "brilliant application". If you have already configured your application on the server side, meaning others can evaluate your application via a URL, you can try the following approach.
see https://bookdown.org/yihui/bookdown/web-pages-and-shiny-apps.html , second paragraph
A related function
knitr::include_app()
, which is very similar toinclude_url()
, and was designed to embed shiny apps via their exit URLs.
source to share
If I understand your question correctly, maybe the following url could help you:
http://rmarkdown.rstudio.com/authoring_shiny.html
As you can see in the example (above, under Browse), you should include the standard r code snippet in your RMarkdown doc where you can write your shiny code.
You don't need to follow the Shiny skeleton pattern. The only thing to do is add a line runtime: shiny
to the YAML header and publish the file in the .Rmd
usual way.
I hope this is helpful.
source to share