8.2 Interactive reporting with Shiny

Using knitR, Sweave or any other version of literate programming can give us reproducible, automated data analysis and report generation. However, the reports produced in this way are ultimately still static, with graphs and charts locked to the specifications of the R code. Shiny is an R tool that can be used to overcome this, by generating dynamic HTML plots that can be changed by the viewer to suit their preferences.

As an example, a static report may define a histogram with data divided into five levels. Using Shiny, a viewer of this data may choose to look in higher resolution, with 10 or 12 levels; conversely, they may generate a very broad summary of the data in just three levels. Similarly, another analysis may output a list of samples that are relevant at a p-value of 0.05, but with Shiny, the user can change that selection to list samples significant only at 0.01, or 0.001.

Unfortunately Shiny does not work well with the web-based RStudio version that we are using for this workshop, so in this session your instructor will demonstrate examples of interactive reporting with Shiny. These are based on the examples at http://shiny.rstudio.com/tutorial/, so if you have R and RStudio installed on your laptop, you are welcome to try them out for yourself at the same time. Even if you don’t join in now, have a go at them later - the examples on this page are specifically designed to help you teach yourself how to use Shiny.