Skip to content

Instantly share code, notes, and snippets.

@walkerke
Created December 12, 2022 19:22
Show Gist options
  • Save walkerke/017aef54c16085a4c9b5f48cd48300c6 to your computer and use it in GitHub Desktop.
Save walkerke/017aef54c16085a4c9b5f48cd48300c6 to your computer and use it in GitHub Desktop.
library(tidycensus)
library(tidyverse)
akron_2010 <- get_decennial(
geography = "place",
year = 2010,
variables = "P001001",
state = "OH"
) %>%
filter(NAME == "Akron city, Ohio") %>%
pull(value)
akron_2020 <- get_decennial(
geography = "place",
year = 2020,
variables = "P1_001N",
state = "OH"
) %>%
filter(NAME == "Akron city, Ohio") %>%
pull(value)
# Percent change (decennial Census): -4.34%
100 * ((akron_2020 - akron_2010) / akron_2010)
akron_08_12 <- get_acs(
geography = "place",
year = 2012,
variables = "B01003_001",
state = "OH"
) %>%
filter(NAME == "Akron city, Ohio") %>%
pull(estimate)
akron_17_21 <- get_acs(
geography = "place",
year = 2021,
variables = "B01003_001",
state = "OH"
) %>%
filter(NAME == "Akron city, Ohio") %>%
pull(estimate)
# Percent change (ACS): -4.24%
100 * ((akron_17_21 - akron_08_12) / akron_08_12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment