Embedding a Shiny app inside my blog
Posted on Sat 05 May 2018 in Blog
Some years ago, I started experimenting with the computing language R. I have to confess that I don't feel fully comfortable with its syntax, which I find particularly difficult. But I forced myself to get used to it. Why? My main reasons were two: knitr and shiny.
- Knitr is the perfect tool for literate computing. It allows the user to input a combination of code and markdown text providing a clean, human-readable document as output. Indeed, I'm using knitr for writing parts of this website (for example, the dissemination section).
- Shiny is great for making interactive apps, and publishing them as easy-to-use webpages.
For more (and certainly better) information... just google some tutorials. In this short entry, I only want to show an example of what shiny can do (and see how good it works with my new blog).
Take a look at the following simulation I made some years ago to teach some basic ideas about statistical inference:
The steps followed were:
- Write the app itself. Of course, this is the difficult part.
- Publish it. The easiest way is uploading it to ShinyApps. The most popular R editor, RStudio, can do this almost automatically.
- Once this two steps are made, the insertion code I've used is as simple as:
<iframe src="https://pabrod.shinyapps.io/shiny/"
style="border: 2px solid black; width: 100%; height: 1000px;"></iframe>
I'm a big fan of simulation and interactive teaching. More apps will be published soon. Some of them can be previewed in GeoGebraTube.
This entry appears in R-bloggers.com