Last active
March 18, 2020 15:04
-
-
Save balajis/a4153f8711cd6df2aed545b6cbeb4d48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick hack to read latest JHU data and plot confirmed cases and deaths | |
# Dashboard: https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6 | |
# Data: https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series | |
caseplot <- function(filename, color) { | |
uu = read.csv(filename, header=TRUE, stringsAsFactors=FALSE) | |
vv = uu[which(uu[,2] == "US"),] | |
cumulative.confirmed = apply(vv[,5:60], 2, sum) | |
new.confirmed = diff(cumulative.confirmed) | |
plot(new.confirmed, col=color, type='o', xlab="", ylab="", main="", lty="dashed", pch=20) | |
} | |
pdf(file="new-confirmed-cases-us.pdf") | |
infile1 <- "https://github.com/CSSEGISandData/COVID-19/raw/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv" | |
caseplot(infile1, color="black") | |
title(xlab="Days since Jan 21, 2020", ylab="New Cases", main="Daily New Confirmed Cases (US)") | |
dev.off() | |
pdf(file="new-confirmed-deaths-us.pdf") | |
infile2 <- "https://github.com/CSSEGISandData/COVID-19/raw/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Deaths.csv" | |
caseplot(infile2, color="red") | |
title(xlab="Days since Jan 21, 2020", ylab="New Daeths", main="Daily New Confirmed Deaths (US)") | |
dev.off() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment