I recognize, and fully understand, that this data maybe emotionally difficult to work. My intention is to make these lab relevant, allowing you to gather your own insights directly from new visualizations of the data. Please let me know if you would rather not work with the data.
In the RStudio Shiny tutorials Lesson 5 . Go through this tutorial to ensure you can create a Shiny App using the US census data package.
In Lesson 5 there is a step in which you download the census data (counties.rds) to your computer.
counties <- readRDS("ShinyApps/data/counties.rds") # Note I used a different directory
head(counties)## name total.pop white black hispanic asian
## 1 alabama,autauga 54571 77.2 19.3 2.4 0.9
## 2 alabama,baldwin 182265 83.5 10.9 4.4 0.7
## 3 alabama,barbour 27457 46.8 47.8 5.1 0.4
## 4 alabama,bibb 22915 75.0 22.9 1.8 0.1
## 5 alabama,blount 57322 88.9 2.5 8.1 0.2
## 6 alabama,bullock 10914 21.9 71.0 7.1 0.2
If you go to JHU times series reporting data you can also see that there is country level information on confirmed cases and deaths
library(tidyverse)
US_time_series_confirmed <- read_csv(url("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_US.csv"))
head(US_time_series_confirmed, 10)## # A tibble: 10 x 108
## UID iso2 iso3 code3 FIPS Admin2 Province_State Country_Region Lat
## <dbl> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr> <dbl>
## 1 1.60e1 AS ASM 16 60 <NA> American Samoa US -14.3
## 2 3.16e2 GU GUM 316 66 <NA> Guam US 13.4
## 3 5.80e2 MP MNP 580 69 <NA> Northern Mari… US 15.1
## 4 6.30e2 PR PRI 630 72 <NA> Puerto Rico US 18.2
## 5 8.50e2 VI VIR 850 78 <NA> Virgin Islands US 18.3
## 6 8.40e7 US USA 840 1001 Autau… Alabama US 32.5
## 7 8.40e7 US USA 840 1003 Baldw… Alabama US 30.7
## 8 8.40e7 US USA 840 1005 Barbo… Alabama US 31.9
## 9 8.40e7 US USA 840 1007 Bibb Alabama US 33.0
## 10 8.40e7 US USA 840 1009 Blount Alabama US 34.0
## # … with 99 more variables: Long_ <dbl>, Combined_Key <chr>, `1/22/20` <dbl>,
## # `1/23/20` <dbl>, `1/24/20` <dbl>, `1/25/20` <dbl>, `1/26/20` <dbl>,
## # `1/27/20` <dbl>, `1/28/20` <dbl>, `1/29/20` <dbl>, `1/30/20` <dbl>,
## # `1/31/20` <dbl>, `2/1/20` <dbl>, `2/2/20` <dbl>, `2/3/20` <dbl>,
## # `2/4/20` <dbl>, `2/5/20` <dbl>, `2/6/20` <dbl>, `2/7/20` <dbl>,
## # `2/8/20` <dbl>, `2/9/20` <dbl>, `2/10/20` <dbl>, `2/11/20` <dbl>,
## # `2/12/20` <dbl>, `2/13/20` <dbl>, `2/14/20` <dbl>, `2/15/20` <dbl>,
## # `2/16/20` <dbl>, `2/17/20` <dbl>, `2/18/20` <dbl>, `2/19/20` <dbl>,
## # `2/20/20` <dbl>, `2/21/20` <dbl>, `2/22/20` <dbl>, `2/23/20` <dbl>,
## # `2/24/20` <dbl>, `2/25/20` <dbl>, `2/26/20` <dbl>, `2/27/20` <dbl>,
## # `2/28/20` <dbl>, `2/29/20` <dbl>, `3/1/20` <dbl>, `3/2/20` <dbl>,
## # `3/3/20` <dbl>, `3/4/20` <dbl>, `3/5/20` <dbl>, `3/6/20` <dbl>,
## # `3/7/20` <dbl>, `3/8/20` <dbl>, `3/9/20` <dbl>, `3/10/20` <dbl>,
## # `3/11/20` <dbl>, `3/12/20` <dbl>, `3/13/20` <dbl>, `3/14/20` <dbl>,
## # `3/15/20` <dbl>, `3/16/20` <dbl>, `3/17/20` <dbl>, `3/18/20` <dbl>,
## # `3/19/20` <dbl>, `3/20/20` <dbl>, `3/21/20` <dbl>, `3/22/20` <dbl>,
## # `3/23/20` <dbl>, `3/24/20` <dbl>, `3/25/20` <dbl>, `3/26/20` <dbl>,
## # `3/27/20` <dbl>, `3/28/20` <dbl>, `3/29/20` <dbl>, `3/30/20` <dbl>,
## # `3/31/20` <dbl>, `4/1/20` <dbl>, `4/2/20` <dbl>, `4/3/20` <dbl>,
## # `4/4/20` <dbl>, `4/5/20` <dbl>, `4/6/20` <dbl>, `4/7/20` <dbl>,
## # `4/8/20` <dbl>, `4/9/20` <dbl>, `4/10/20` <dbl>, `4/11/20` <dbl>,
## # `4/12/20` <dbl>, `4/13/20` <dbl>, `4/14/20` <dbl>, `4/15/20` <dbl>,
## # `4/16/20` <dbl>, `4/17/20` <dbl>, `4/18/20` <dbl>, `4/19/20` <dbl>,
## # `4/20/20` <dbl>, `4/21/20` <dbl>, `4/22/20` <dbl>, `4/23/20` <dbl>,
## # `4/24/20` <dbl>, `4/25/20` <dbl>, `4/26/20` <dbl>, `4/27/20` <dbl>
There is some data wrangling to be done to join the US Census data with the COVID-19 confirmed cases and deaths involving differences in capitalization, merging (or separating columns). However, I think you are ready for the rodeo based on your accomplishments this semester! Remember there are examples using the covid data at the country level in Lab 10.
The goal of these exercises are to further develop your data wrangling and graphing skills using real world data. In previous labs we put most of the data wrangling steps upstream of the Shiny App ui and server code. This is prefered because these steps are only do once, not each time a new value or field is selected by the user in the ui or server sections.
To date the approach for making Shiny Apps to create a single data frame/tibble with the needed data. Using the county map data in combination with census and the US time series covid-19 data generates large tables that can tax your computers RAM memory and cause R to crash. A way to reduce your data frame sizes is to include the user selection before you combine the date. For example in Exercise #1, filtering the time series data by date before joining the table decreases the table length nearly 100x.
For Exercise 1 you could start by
Here is an example that I made. Yours may look different.
Submit the url to your Shiny app in Moodle.