How to include a shiny app in a bookdown document? There is an example for including the miniUI in the documentation, but not on how to include an own app.
I tried to include "myapp" in the subdirectory "myapp" either as an integrated file (app.R) or as the two files server.R and ui.R using include_app("myapp") or runApp("myapp"), but this doesn't work.
This question was asked a while back, but I will provide an answer in case anyone else is trying to set this up.
Both functions knitr::include_app()
and knitr::include_url()
require an URL, which should be the address to the website where you publish your Shiny app. So if you want to build your own app, I suggest you first publish it to the web, and then embed it into the HTML code produced by bookdown using the instructions found here: https://bookdown.org/yihui/bookdown/web-pages-and-shiny-apps.html. Basically, you will need to:
knitr::include_app()
to integrate your Shiny app into your bookdown, as decribed here https://bookdown.org/yihui/bookdown/web-pages-and-shiny-apps.html..With a FREE account at shinyapps.io, you can publish up to 5 apps. I recommend you try the miniUI package to publish your Shiny app, because it will make the app easily fit into the HTML page generated by bookdown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With