Skip to contents

load_acs_vars() calls tidycensus::load_variables() and then combines the returned data frame with the Census Reporter metadata from label_acs_table_metadata(). The function can optionally filter the variable definitions to a set of tables and variables or drop variables from the results.

Usage

load_acs_vars(
  year = 2021,
  survey = "acs5",
  cache = TRUE,
  variable_col = "variable",
  geography_levels = c("block", "block group", "tract", "county", "state", "us"),
  table = NULL,
  vars = NULL,
  drop_vars = NULL
)

Arguments

year

Sample year (between 2006 and 2021).

survey

Survey, "acs5", "acs3", or "acs1".

cache

Whether you would like to cache the dataset for future access, or load the dataset from an existing cache. Defaults to FALSE.

variable_col

Variable column name. Defaults to "variable"

geography_levels

Ordered vector of geography levels used to convert the geography column returned by tidycensus::load_variables() into a factor. Default: c("block", "block group", "tract", "county", "state", "us")

table

Table ID to return.

vars, drop_vars

Variable IDs to keep or to drop. If table is supplied (or if data only contains data for a single table), numeric values are allowed for vars and drop_vars (e.g. if table is "B14001" and vars is 2 data is filtered to variable "B14001_002").

Value

A data frame with ACS variables definitions.