Summary and Setup

This is a new lesson built with The Carpentries Workbench.

This workshop will be a foundational introduction to building websites and apps using the R Shiny framework. While knowing multiple languages (HTML, CSS, Javascript, SQL, etc.) might otherwise be necessary to build a website, R Shiny allows R users to use just R code plus “R-like” code to assemble every part of a website. As such, R users can unlock the immense power of the world wide web by adding just another “half a language” to their toolbox! Topics include a brief introduction to HTML and CSS (as a frame of reference), project organization and conventions, input widgets, events and event handling, directive programming, building interactive tables, graphs, and maps, and updating complex graphics on the fly using proxies.

Required Setup


This lesson assumes you have R and RStudio installed. If you need either, use the links below:

RStudio is an application (an integrated development environment, or IDE, to be exact) that facilitates the use of R and offers a number of nice features. While R Studio is not strictly required to use base R, it is all but required to build Shiny app (to try to build a Shiny app in base R sounds nightmarish to me, and I’m not sure it’s even possible).

This lesson also takes advantage of several add-on packages for R that do not come bundled with R’s default installation. While we will also pause to install these packages during the lesson, the process can take some time, so these packages can be installed ahead of time using the following command:

R

install.packages(c("shiny", "dplyr", "ggplot2", "leaflet", "DT", "plotly", "gapminder", "sf"))

Data Sets


We’ll use the gapminder data set for this lesson, available via the gapminder package:

R

library(gapminder)
gap = gapminder

I recommend accessing it via the code above, but you may also download it via this link.

For the leaflet portion of the lesson, we’ll need spatial data to work with. You can download a special version of the gapminder data set with spatial data attached via this link: Link to the gapminder data set with attached spatial data.

Disclaimers


This lesson assumes a working understanding of the R programming language and of the RStudio IDE. This workshop is not an introduction to R or RStudio, and it is not recommended for users who need either thing. Those who do are strongly encouraged to complete, at a minimum, the “Welcome to R” and “Control Flow” lessons available on our website before engaging with in this lesson.

A familiarity with the dplyr, ggplot2, and sf packages and their syntax will be helpful later in the lesson, but it is not required.