Interactive Plot in Blogdown

Shiny apps and Blogdown could be the game changer, and R is no longer just a niche language for quick data modeling. R/Rstudio is becoming a platform for data scientist to do all his or her work. A data scientist with not much experience with building a website, like me, can use Shiny + Blogdown to produce a (almost-)professional personal webiste.

Create a Shiny app and deploy it

Shiny apps can’t be run client-side like javascript can. And they can’t be deployed on a standard webserver. Shiny apps need to be hosted on a server with R and shiny installed and connected to a running R process.

Following the example by Paul Campbell, we updated the Shiny app with

HTML('<div data-iframe-height></div>')

Then, add the following to the Rmarkdown:

<script type="text/javascript" src=""></script>
  iframe {
    min-width: 100%;
<iframe id="myIframe" src="" scrolling="no" frameborder="no"></iframe>
    heightCalculationMethod: 'taggedElement'

Ok, now we have a resizable iframe. However, Shiny apps use fluid output as default, so that the size of sidebar, relative to the main panel, cannot be changed.