# load sample demographic data
mo22_demos <- zi_mo_pop
# the above data can be replicated with the following code:
# zi_get_demographics(year = 2022, variables = c("B01003_001", "B19013_001"),
# survey = "acs5")
# load sample geometric data
mo22_zcta3 <- zi_mo_zcta3
# the above data can be replicated with the following code:
# zi_get_geometry(year = 2022, style = "zcta3", state = "MO",
# method = "intersect")
# aggregate a single variable
zi_aggregate(mo22_demos, year = 2020, extensive = "B01003_001", survey = "acs5",
zcta = mo22_zcta3$ZCTA3)
# \donttest{
# aggregate multiple variables, outputting wide data
zi_aggregate(mo22_demos, year = 2020,
extensive = "B01003_001", intensive = "B19013_001", survey = "acs5",
zcta = mo22_zcta3$ZCTA3, output = "wide")
# }
Run the code above in your browser using DataLab