Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JonasSchroeder/c61e9a3c8defff98627a09da72f709df to your computer and use it in GitHub Desktop.
Save JonasSchroeder/c61e9a3c8defff98627a09da72f709df to your computer and use it in GitHub Desktop.
Featured in this medium article: "A Beginner’s Guide to Creating a Corona “Dashboard” (Part 1)" https://medium.com/@jonas.schroeder1991/a-beginners-guide-to-creating-a-corona-dashboard-3553b01d8d44
# Data gathered from European Center for Disease Prevention and Control
# https://www.ecdc.europa.eu/en/publications-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide
# Note: Number of cases per day may differ from other sources; cases might be moved from one day to another
library(readxl)
library(httr)
# Define date of data pull (may set date to current date)
url <- paste("https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide-", "2020-03-22", ".xlsx", sep = "")
# DL and read data set
GET(url, authenticate(":", ":", type="ntlm"), write_disk(tf <- tempfile(fileext = ".xlsx")))
data <- read_excel(tf)
# Extract country-level data, e.g. for China
data_china <- filter(data, data$GeoId=="CN")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment