Created
July 27, 2023 17:18
-
-
Save walkerke/774ea3cbef9a9b0e7d75037fa332f772 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
library(tidycensus) | |
library(tigris) | |
library(tidyverse) | |
library(sf) | |
library(srvyr) | |
options(tigris_use_cache = TRUE) | |
sf_area <- metro_divisions() %>% | |
filter(GEOID %in% c("4186042034", "4186041884")) | |
sf <- pumas(year = 2019, cb = TRUE, state = "CA") %>% | |
st_point_on_surface() %>% | |
st_filter(sf_area) %>% | |
pull(PUMACE10) | |
sf_wage_occ <- get_pums( | |
variables = c("WAGP", "OCCP", "ESR"), | |
state = "CA", | |
puma = sf, | |
survey = "acs1", | |
year = 2021, | |
recode = TRUE, | |
variables_filter = list( | |
COW = 1:8 | |
), | |
rep_weights = "person" | |
) %>% | |
to_survey() | |
sf_compare <- sf_wage_occ %>% | |
mutate(comparison = case_when( | |
OCCP == "6230" ~ "Carpenters", | |
OCCP == "1021" ~ "Software developers", | |
TRUE ~ "Other" | |
))%>% | |
filter(comparison != "Other") | |
sf_compare %>% | |
group_by(comparison, ESR_label) %>% | |
summarize(average = survey_mean(WAGP, na.rm = TRUE)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was great - I just modified this for a research project. For others looking for occupation codes, you can find them here: https://www.eeoc.gov/federal-sector/management-directive/eeoc-federal-sector-occupation-cross-classification-table