Load data from the American Community Survey Public Use Microdata Series API
get_pums( variables = NULL, state = NULL, puma = NULL, year = 2021, survey = "acs5", variables_filter = NULL, rep_weights = NULL, recode = FALSE, return_vacant = FALSE, show_call = FALSE, key = NULL )
A vector of variables from the PUMS API.
View(pums_variables) to browse variable options.
A state, or vector of states, for which you would like to
request data. The entire US can be requested with
state = "all" - though be patient with the data download!
A vector of PUMAs from a single state, for which you would like
to request data. To get data from PUMAs in more than one state, specify a
named vector of state/PUMA pairs and set
state = "multiple".
The data year of the 1-year ACS sample or the endyear of the 5-year sample. Defaults to 2020. Please note that 1-year data for 2020 is not available in tidycensus, so users requesting 1-year data should supply a different year.
The ACS survey; one of either
A named list of filters you'd like to return from the
PUMS API. For example, passing
list(AGE = 25:50, SEX = 1) will return
only males aged 25 to 50 in your output dataset. Defaults to
which returns all records. If a housing-only dataset is required,
list(SPORDER = 1) to only return householder records (taking care
in your analysis to use the household weight
Whether or not to return housing unit, person, or both
housing and person-level replicate weights for calculation of standard
errors; one of
If TRUE, recodes variable values using Census data dictionary
and creates a new
*_label column for each variable that is recoded.
Available for 2017 - 2021 data. Defaults to FALSE.
If TRUE, makes a separate request to the Census API to retrieve microdata for vacant housing units, which are handled differently in the API as they do not have person-level characteristics. All person-level columns in the returned dataset will be populated with NA for vacant housing units. Defaults to FALSE.
If TRUE, display call made to Census API. This can be very useful in debugging and determining if error messages returned are due to tidycensus or the Census API. Copy to the API call into a browser and see what is returned by the API directly. Defaults to FALSE.
Your Census API key. Obtain one at https://api.census.gov/data/key_signup.html
A tibble of microdata from the ACS PUMS API.