Reputation: 533
I would like to create an html document with RMarkdown, containing text, Rcode and somewhere in between a shiny application.
asis=TRUE
for the shinyApp(ui, server)
block, but RStudio only renders the Rmd file, if I add runtime: shiny
to the YAML-Header.How to generate html-code from the shinyApp function? Or: How to generate an html file, from RMarkdown containing a shiny app instead of e.g. a plot
I hope you have some idea for me.
Upvotes: 7
Views: 10020
Reputation: 639
I don't really understand what you mean by "a shiny application". If you have already set up a server side application, i.e. others can access your application via URL, you can try the following approach.
See https://bookdown.org/yihui/bookdown/web-pages-and-shiny-apps.html, second paragraph.
A related function is
knitr::include_app()
, which is very similar toinclude_url()
, and it was designed for embedding Shiny apps via their URLs in the output.
Upvotes: 4
Reputation: 1
'Note: If you are familiar with R Markdown, you might expect RStudio to save an HTML version of an interactive document in your working directory. However, this only works with static HTML documents. Each interactive document must be served by a computer that manages the document. As a result, interactive documents cannot be shared as a standalone HTML file.'
https://shiny.posit.co/r/articles/build/interactive-docs/
Upvotes: 0
Reputation: 1636
If I understand your question correctly then maybe the following URL could be of help for you:
https://bookdown.org/yihui/rmarkdown/shiny-start.html
As you can see: You don't have to follow the Shiny skeleton template. The only thing to do: You have to add the line runtime: shiny
into the YAML-header and publish the .Rmd
file in the normal way, e.g. you have to include a standard r code snippet in your RMarkdown document where you can write your shiny code.
I hope this is helpful.
Upvotes: 2