Skip to contents

Retrieves and formats ACS ethnicity data for use in survey imputation, supporting binary or multi-level ethnicity. Use for imputing ethnicity in survey data using ACS reference.

Usage

get_acs_ethnicity(
  settings,
  ethnicity_levels,
  year = NULL,
  is_binary = TRUE,
  return_counts = FALSE
)

Arguments

settings

list. Settings object with ACS configs.

ethnicity_levels

character vector. Ethnicity levels to use.

year

integer(1), optional. ACS year for imputation.

is_binary

logical(1). Use binary (TRUE) or multi-level (FALSE).

return_counts

logical(1). Return counts (TRUE) or fractions (FALSE).

Value

data.table. GEOID and ethnicity columns for imputation.

Details

  • Fetches ACS table for block group (binary) or tract (multi-level).

  • Applies string replacements and recodes topcoded variables.

  • Checks consistency with target levels and sums.

  • Returns data.table with GEOID and fraction/count columns.

  • Assumes settings include ACS year and target levels.

Settings

  • acs_year (direct): ACS year for ethnicity table.

Examples

## Not run:
get_acs_ethnicity(settings, c('hispanic', 'not_hispanic'))
#> Error in get_acs_ethnicity(settings, c("hispanic", "not_hispanic")): could not find function "get_acs_ethnicity"