Code
library(tidyverse)
library(tidycensus)
#Make Mass Median Income
mass_med_income <-
get_acs(
geography = "county",
variables = c(med_household_income = "B19013_001"),
state = "MA",
# We'll need to pivot wider, but that doesn't work with simple features.
geometry = TRUE
)|>
# Add centroids to each region using purrr package
tidyr::separate(NAME, c("County", "State"), sep = ", ") |>
tidyr::separate(County, c("County", "Fluff"), sep = " ") |>
mutate(med_household_income = estimate) |>
mutate(med_income_discrete = cut_interval(
med_household_income,
length = 15000,
labels = c("60-75", "75-90","90-105", "105-120","120-135")
))




