In this lab, you’ll practice building interactive webpages using RShiny with COVID-19 case data. Rather than generating an .md file with your lab answers, your code will generate an RShiny application within an R Markdown document.
Each member of the team should:
lab-07-shiny-YOUR_TEAM_NAME
.lab-07.Rmd
and Knit it.
Make sure it compiles without errors.Before we introduce the data, let’s warm up with some simple exercises.
We’ll use the tidyverse package for much of the data wrangling and visualization, and the shiny package to create our interactive data summaries and visualizations, and the DT package to render interactive tables.
library(tidyverse)
library(shiny)
library(DT)
We will be using a data set on COVID-19 cases. Read in the data set using the following command.
<- read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv") covid_cases
A description of the data set was not provided, other than that it is “COVID-19” data. Navigate to the Github page where the data were obtained. Use the description of this Github page and an examination of the data you loaded to write a few sentences describing this data set. What information do these data provide the user? What are the observational units and variables? What dimension is the data set?
Convert the data set from wide to long format.
Allow users to select the date to display in the table. Note the
DT::renderDataTable
might be useful (this is the
renderDataTable
function in the DT
package).
Read in a US level COVID-19 dataset and convert this to a long dataframe.
<- read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_US.csv") US_data
Create an interactive figure of your choice. You can consider filtering by state / province to show curves, include colors and/or faceting based on selected variables, or something else of your choosing.