Workflow

Data production, plotting, and the generation of this website all use the programming language R. The workflows are split into three processes - an “AM” process that builds data from the New York Times, a “PM” process that builds data from other sources, and a final site building process to create this site itself. All source code for visualization is available in this project’s GitHub repository. An accompanying repository includes all of the source code for creating data sets.

Downloading Case and Mortality Data

To download the data from the New York Times:

get_times <- function(end_date){
  
  # create values
  url <- c("https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv")
  
  # download data
  response <- RCurl::getURL(url = url)
  
  # read data
  df <- readr::read_csv(response)
  
  # tidy data
  df <- dplyr::filter(df, state %in% 
                      c("Arkansas", "Kansas", "Missouri", "Illinois", "Oklahoma"))
  df <- dplyr::rename(df,
                      confirmed = cases,
                      report_date = date,
                      geoid = fips)
  df <- dplyr::mutate(df, geoid = ifelse(county == "Kansas City", "29511", geoid))
  df <- dplyr::mutate(df, geoid = ifelse(county == "Joplin", "29512", geoid))
  df <- dplyr::select(df, geoid, report_date, confirmed, deaths)
  
  if (is.null(end_date) == FALSE){
    
    df <- dplyr::filter(df, report_date <= as.Date(end_date))
    
  }
  
  # return output
  return(df)
  
}

Other Notes

  • The Fisher breaks algorithm (Fisher 1958, Slocum et al. 2005) is used to identify legend categories on maps
  • Estimated populations for the the four counties around Kansas City as well as Kansas City itself were created using areal weighted interpolation (see Prener and Revord 2019)
  • Estimated populations for partial zip codes are also created using areal weighted interpolation (see Prener and Revord 2019)



Copyright © 2020-2021 Christopher Prener, Ph.D. All code, data, website content, and images are available under a Creative Commons Attribution 4.0 International License.