This is an R notebook to help visualize the numbers regarding COVID-19 in Lubbock, TX. I’ve been keeping this data in JSON format as press releases come out from the City of Lubbock. The code for this notebook can be found here -> https://github.com/jreina/lubbock-covid.
Last Updated: 2020-12-02 11:31:49
library('jsonlite')
cases <- as.data.frame(fromJSON("./data/cases.json"))
dates <-as.Date(cases$date, "%m/%d/%Y")
cases$difference = c(0, diff(cases$confirmed))
dailyDeaths <- diff(c(0, cases$deaths))
cases <- cases[, c(1, 3, 7, 4, 5, 6, 7)]
newCases <- cases$confirmed - cases$recovered - cases$deaths
plot.new()
plot(x = dates, y = newCases,
xlim = range(dates), ylim = range(c(newCases, cases$recovered)),
xlab = 'Date', ylab = 'Count',
type = 'l', lwd = 2.5, col = 'red', lty = 1,
main = 'Active Cases vs. Cumulative Recoveries')
lines(x = dates, y = cases$recovered, lwd = 2.5, col = 'blue', lty = 1)
legend('topleft', legend = c('Active cases', 'Recoveries'), col = c('red', 'blue'), lty = 1, lwd = 2.5)
plot.new()
plot(x = dates, y = cases$difference,
xlim = range(dates), ylim = range(cases$difference),
xlab = 'Date', ylab = 'Count',
type = 'l', lwd = 2.5, col = 'blue', lty = 1,
main = 'New Cases')
legend('topleft', legend = c('New cases'),
col = c('blue'), lty = 1, lwd = 2.5)
plot.new()
plot(x = dates, y = dailyDeaths,
xlim = range(dates), ylim = range(dailyDeaths),
xlab = 'Date', ylab = 'Count',
type = 'l', lwd = 2.5, col = 'blue', lty = 1,
main = 'New Deaths')
legend('topleft', legend = c('New deaths'),
col = c('blue'), lty = 1, lwd = 2.5)
plot.new()
plot(x = dates, y = cases$difference,
xlim = range(dates), ylim = range(cases$difference),
xlab = 'Date', ylab = 'Count',
type = 'l', lwd = 2.5, col = 'red', lty = 1,
main = 'Daily cases vs daily deaths')
par(new = TRUE)
plot(x = dates, y = dailyDeaths, col = 'blue', axes = FALSE, xlab = 'Date', ylab = 'Count',
type = 'l', lwd = 2)
axis(side = 4, at = pretty(range(dailyDeaths)))
legend('topleft', legend = c('New cases', 'deaths'), col = c('red', 'blue'), lty = 1, lwd = 2.5)
plot(x = dates,
y = cases$confirmed,
xlim = range(dates),
ylim = range(cases$confirmed),
xlab = 'Date',
ylab = 'Count',
col = 'black',
type = 'l',
lwd = 2.5,
main = 'Cumulative Statistics (Lubbock County)')
lines(dates, cases$recovered, col = "green", lwd = 2.5)
lines(dates, cases$deaths, col = "red", lwd = 2.5)
lines(x = dates, y = cases$difference, lwd = 1, col = 'purple', lty = 2)
legend('topleft', legend = c('Confirmed', 'Recovered', 'Deaths', 'Difference'),
col = c('black', 'green', 'red', 'purple'), lty = c(1, 1, 1, 2), lwd = c(2.5, 2.5, 2.5, 1))
library(xtable)
print(xtable(cases), type = "html")
This data likely varies from official data since it is based on press releases instead of aggregated health department data from the State of Texas. This data is provided purely for informational purposes.