I am trying to get census data for tenure status in various zip codes using R. I used the syntax that I used for all of my other API calls and copied the variable name exactly from the API key here: https://api.census.gov/data/2021/acs/acs1/groups/C25032.html
The variables also appear identically in this call:
variables <- load_variables(2021, "acs1", cache = TRUE)
Here is what I tried:
acs_total_units <- get_acs(geography = "zcta",
variables = "C25032001E", year = 2021)
This returns the following error: Error: Your API call has errors. The API message returned is error: error: unknown variable 'C25032001E'.
I expected this to create a dataframe with every zip code (GEOID) and their estimates for the total units in that zip code. Adding an underscore or removing the E does not change anything.
I was going to copy this code for renters and owner-occupied units, but those do not work either. I need to use the zip code geography for the data I am gathering.
In tidycensus, the "E" or "M" suffixes for variables are not required, per the tidycensus basic usage instructions.
Also, in the 2021 ACS 1 year data set, the geography
zctais not supported. Instead, one can extract theC25032_001variable withgeography = "puma"....and the output:
However, when we set
geography = "puma"the same query returns the requested data.In the 2021 ACS 1 year survey, the state of Georgia has 72 PUMA areas. We'll print the first six.
The complete list of geographies available for the 2021 ACS-1 public use microdata sample is available on the U.S. Census API Site, but the supported geographies table is posted here as a reference.