Summary and Schedule
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.
Setup Instructions | Download files required for the lesson | |
Duration: 00h 00m | 1. Welcome to the Web! Web Development with Shiny 101 |
How is a website built? How is building a website using R Shiny similar to/different from the “usual” way? What does a website “look like,” under the hood? What are the most common website “building blocks?” ::: |
Duration: 00h 45m | 2. Building the Ground Floor of a Shiny App |
How should I start building a Shiny app? What code’s required to get a Shiny app to start? What goes in my server.R file? My
ui.R file? My global.R file?How do I design an app that’ll look nice on any device? ::: |
Duration: 01h 00m | 3. R Shiny’s Core Concepts: Rendering and Outputting, Input Widgets, and Reactivity |
How do I add cool features to my app? How do I give my users meaningful things to do on my app? How do I get my app to respond meaningfully to user actions? How do I give users control over when/how my app responds? How do I give myself control over when/how my app responds? How is R Shiny server code different than code I may have written before? ::: |
Duration: 02h 00m | 4. Shiny Showstoppers: DTs and Leaflets and Plotlys, Oh My! |
How do I add an interactive map/table/graph to my app? What features do these widgets have? How do I adjust their appearance? How can I modify these widgets to handle events without simply rebuilding them each time? What events related to these widgets can I watch for? ::: |
Duration: 03h 10m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Required Setup
This lesson assumes you have R and RStudio installed. If you need either, use the links below:
Download and install the latest version of R for your operating system.
Download and install RStudio for your operating system.
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.