Skip to content

Instantly share code, notes, and snippets.

@vikjam
Last active April 5, 2020 16:54
Show Gist options
  • Save vikjam/f91acfb1b825c0345fc7f4a7c1f6c75e to your computer and use it in GitHub Desktop.
Save vikjam/f91acfb1b825c0345fc7f4a7c1f6c75e to your computer and use it in GitHub Desktop.
COVID-19 Cases (San Diego County, by ZIP Code) - Updated April 4, 2020

COVID-19 Cases (San Diego County, by ZIP Code) - Updated April 4, 2020

Sources:

County officials stressed the presence of cases, or lack thereof, should not affect how people operate during the coronavirus pandemic.

Staying at home, practicing social distancing and washing your hands are just some practices to maintain, regardless of the number of cases reported in your community.

The number of people actually infected with the disease is likely much higher than reported numbers because not everyone needs to be tested, including in some cases, the close contacts of positive patients who are usually presumed to have the disease.

library(readr)
library(tidycensus)
library(dplyr)
library(stringr)
cases <- read_csv("https://gist.githubusercontent.com/vikjam/f91acfb1b825c0345fc7f4a7c1f6c75e/raw/a58fc598ca58e36c7d2960cf1c59d3f314a2b527/cases_by_zip.csv")
acs_population <- get_acs(geography = "zcta",
variables = c(population = "B01001_001"),
year = 2018) %>%
filter(str_sub(GEOID, 1, 2) %in% c("91", "92")) %>%
select(GEOID, estimate) %>%
rename(zip = GEOID, population = estimate)
cases_pop <- inner_join(cases, acs_population, by = "zip")
zip confirmed_cases
91901 1
91902 10
91909 1
91910 28
91911 24
91913 21
91914 3
91915 8
91916 1
91932 3
91935 1
91941 8
91942 12
91945 13
91950 18
91977 24
91978 3
92004 1
92007 4
92008 8
92009 16
92010 9
92011 6
92014 12
92019 26
92020 39
92021 28
92024 23
92025 12
92026 7
92027 6
92028 6
92029 9
92037 31
92039 1
92040 9
92054 8
92056 11
92057 7
92058 5
92061 2
92064 13
92065 7
92066 2
92067 12
92069 7
92071 14
92075 4
92078 11
92081 10
92082 3
92083 2
92084 10
92085 1
92088 0
92091 2
92092 0
92093 4
92101 29
92102 14
92103 65
92104 34
92105 29
92106 9
92107 3
92108 14
92109 24
92110 15
92111 15
92113 29
92114 24
92115 21
92116 31
92117 19
92118 4
92119 6
92120 16
92121 3
92122 13
92123 16
92124 11
92126 22
92127 19
92128 25
92129 18
92130 21
92131 6
92136 2
92139 18
92145 1
92147 0
92154 28
92159 0
92161 2
92168 1
92173 12
92196 1
Unknown 22
library(ggplot2)
library(hrbrthemes)
p_cases_vs_pop <- ggplot(cases_pop, aes(x = population, y = confirmed_cases)) +
geom_point() +
labs(x="Population", y="Confirmed cases",
title="Population versus COVID-19 Cases, by ZIP Code",
subtitle="Restricted to San Diego County",
caption="Updated April 4, 2020") +
theme_ipsum_rc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment