Skip to content

Instantly share code, notes, and snippets.

@chasemc
Created July 11, 2020 17:01
Show Gist options
  • Save chasemc/19ec25ddce598eb607e28695354ca144 to your computer and use it in GitHub Desktop.
Save chasemc/19ec25ddce598eb607e28695354ca144 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(data.table)
library(geofacet)
library(magrittr)
raw_data <- data.table::fread("http://covidtracking.com/api/states/daily.csv")
raw_data$date <- as.Date(as.character(raw_data$date), "%Y%m%d")
raw_data <- raw_data[date > "2020-03-15", ]
a <- ksmooth(raw_data[state=="IL"]$date,
raw_data[state=="IL"]$positiveIncrease,
kernel = "box",
bandwidth = 3)$y
b <- ksmooth(raw_data[state=="IL"]$date,
raw_data[state=="IL"]$totalTestResultsIncrease,
kernel = "box",
bandwidth = 3)$y
plot((a/b) * 100, type= "l")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment