The purpose of this project is to use the R Shiny framework to build a COVID tracking and analysis tool that can compare Minnesota counties with other Minnesota counties and to the state as a whole across several measures. This is nothing ground breaking.
- RStudio (makes it easier to run the app and edit code base)
The contents of the Shiny App are segmented into 5 .R files.
- run.R - runs the Shiny App
- init.R - loads all required R packages
- ui.R - standard shiny ui.R file
- server.R - standard shiny server.R file
- data_import.R - imports and wrangles data
RStudio is the easiest way to run this app. Simply set the working directory to the COVID-19-Minnesota-Counties directory then open run.R and click "Run App" button.
setwd(~/COVID-19-Minnesota-Counties) #change to your location
or just source the run.R
file in the R Console.
setwd(~/COVID-19-Minnesota-Counties) #change to your location
source(run.R)
viola, you now have access to the app directly in RStudio (or in any web browser)!
An alternate way to run this app is with the app.sh
bash script. This checks for R, then runs the app.
Launch a terminal session and execute these commands.
Here's an example starting with git clone
git clone https://github.com/rennerom/COVID-19-Minnesota-Counties.git
cd COVID-19-Minnesota-Counties
sh app.sh
This will launch the Shiny App in your default web browser.
When you first launch the app you will see an interactive menu on the left and a graph on the right. If you don't see either of these, try building/running the app again.
The graph shows COVID-19 cases per capita over time. By default, state level data, represented as a thick grey line, is toggled on. There are also several "noisy" or "chaotic" looking thin grey lines above and below the state level thick grey line. Each thin line is a single Minnesota county. Once counties are selected in the menu they will be highlighted so that they are easier to view.
Either start by typing in a county, or scrolling through the list of MN counties and select one or more. Each county will be highlighted on the graph
Sets the date limits of the graph. The dates will be as up to date as when you last launched the app or if the New York Times update their source data, which they do each day.
The y-axis limits are determined by the maximum county level cases per capita for ALL counties whether you've selected them in your filter or not. If you want to get your selection to fit the graph a little cleaner, you can zoom the slider as you see fit.
The default of this toggle is to highlight the state level measures. This allows for comparisons for each county to the state as a whole. You can turn it off if you don't need or want it.
- This data is sourced from the New York Times covid-19-data github repo
- Have suggestions? Feel free to contribute by submitting pull requests or collaborate over email.
- Contact: [email protected]
Will do
- Infection rates
- Death rates
- hospitalization rates
- Vaccination rates
- Rolling 4 week percent changes in infections/deaths/hospitalization/vaccination rates
Want to do
- Add/convert additions above using shiny modules
- County geomap selector
- Sortable/filterable data table
Will try to do, time permitting
- Optomize data processing (lots to do here)
- Windows compatible
- Heroku deployment