Hi -
I learned how to do this recently myself. You can use R packages srvyr or survey to use replicate weights to show uncertainty (as used in the PUMS files, these are all the variables with PWGTP[#] in the person file). Here is an example using srvyr:
library(srvyr)
library(tidyverse)
personsRaw <- read.csv("ACS_PUMS_Person_File.csv")
persons_svy <- personsRaw %>% as_survey_rep(
weight = PWGTP,
repweights = matches("PWGTP[0-9]+") ,
scale = 4 / 80,
rscales = rep(1 , 80),
mse = TRUE,
type = "JK1",
variables = c(RAC1P,OCCP)
)
persons_svy %>%
# update the next line to include all desired occupation codes
filter(OCCP >=2600 & OCCP < 2800) %>%
group_by(RAC1P) %>%
# vartype: Report variability as one or more of: standard error ("se", default), confidence interval ("ci"), variance ("var") or coefficient of variation ("cv").
summarize(Employees = survey_total(vartype="ci"))