How to embed a Shiny app in blogdown?
If you have developed and deployed a Shiny app and would like to embed it in blogdown, follow these steps:
- create a new post as usual
output: html_documentif it is not already included) in the YAML metadata
- insert the following HTML code in the body of the post:
<iframe height="800" width="100%" frameborder="no" src="https://antoinesoetewey.shinyapps.io/statistics-201/"> </iframe>
You should change the URL with the URL of your deployed Shiny app (after
src=, do not forget that the URL should start with
https:// and should be surrounded by
"). Moreover, you can modify the height, the width and include or not a frame border with the corresponding tags.
Here is an example of the result with one of my Shiny app (link to the app):
Note that the app may not work if it has hit the monthly usage limit. Try again later if that is the case.
Here is the entire
.Rmd code in case you would like to use it for your own website:
If you encounter an issue, try loading the following packages in the body of your new post:
widgetframe (you can load a package with the command
library(widgetframe)). If one of the package is not installed yet, you can do it with the command
I hope this article helped you to embed a Shiny app in your blogdown website.
As always, if you have a question or a suggestion related to the topic covered in this article, please add it as a comment so other readers can benefit from the discussion. If you find a mistake or bug, you can inform me by raising an issue on GitHub. For all other requests, you can contact me here.
Get updates every time a new article is published by subscribing to this blog.