R & Shiny

RStudio, Shiny and RMarkdown

R is an incredibly popular and widely used scripting language. It's used by researchers across all four divisions of Oxford for data wrangling, analysis and visualisation. The greatest strength of the R community is its commitment to the open development
of supplementary packages; covering such diverse fields as text mining, image processing, multivariate analysis and network analysis.

Most R users are aware of the ggplot2 and base plot libraries that allow static charts and maps to be created and often export these as images for use in publications. However, very few users are aware it is possible to build truly impressive interactive
visualisations and applications using the R language with htmlwidgets and Shiny. Or indeed, how simple it is to build rich documents and presentations with RMarkdown - and to include interactive visualisations built using Shiny in these documents.

We provide significant support and training in both R and Shiny, in addition to an Oxford University funded shinyapps.io subscription.

Shiny

Shiny is developed by RStudio and allows interactive applications like what you see on the right to be developed using only the R language.

The IDN supports users in building their own Shiny apps in the following ways:

Shiny allows data to be ingested from external sources, including live data. This includes the ability to access secure databases, or API. For this reason, Shiny is our recommended tool where you require server-side data processing/access.

Note: This shiny app is a case study you can read about here.

RMarkdown

RMarkdown allows users of RStudio to easily create reports and presentations in either HTML, PDF or Word format. This allows you to directly include your code and output alongside a textual explanation of what your research is about.

The example on the right is an RMarkdown report created in RStudio and published to RPubs for free. Note the interactive networks (hover and click on nodes) integrated with a prosaic explanation
of what the document is about and the code that generates the interactive output.

RMarkdown provides an excellent vehicle for reproducable research. The IDN provides the followign support in using RMarkdown:

Note that RMarkdown is "runtime only" - the data for charts/visualisations is directly embedded into the document. It is not possible for new data to be added. This is often referred to as a "static web page". However, it is possible to embed
Shiny apps in RMarkdown documents via an iframe - which is the same method used to show the Shiny, RMarkdown and htmlwidget examples in this webpage.

htmlwidgets

JavaScript is the language of the interactive web; Google Maps, fivethirtyeight.com, bbc.co.uk/sport all require JavaScript for dragging, clicking and hovering functionality.

htmlwidgets is a tool that allows R developers to make these interactive web elements available in individual R packages. This means users of these packages can create interactive JavaScript content using only the R language.

All of the interactive visualisations on this page (the time series, bar chart, networks and map) were built using htmlwidget libraries.

The IDN provides the following support in using htmlwidgets:

Note: This shiny app is a case study you can read about here.

List of site pages