10

What are the possible levels/options for the geography argument in tidycensus::get_acs(geography = ???)?

I've seen it work as follows:

library(tidycensus)
census_api_key("YOUR API KEY GOES HERE")

vt <- get_acs(geography = "county", 
              variables = "B19013_001", 
              state = "VT")

slc_value <- get_acs(geography = "tract", 
                variables = "B25077_001", 
                state = "UT",
                county = "Salt Lake County",
                geometry = TRUE)

states <- get_acs(geography = "state", 
              variables = "B19013_001")

Are all of the census geographic entities available? (https://www2.census.gov/geo/pdfs/reference/geodiagram.pdf)

And if so how can I specify nation or Zipcode? This code doesn't work:

nation <- get_acs(geography = "nation", 
              variables = "B19013_001")
Chris Kiniry
  • 499
  • 3
  • 13
  • I'm not sure what is currently supported for geographies, but I believe you need to use the names as they are written here: https://www.census.gov/geo/maps-data/data/summary_level.html And if it doesn't support spatial data for the desired geography, you can download the spatial data separately using [`tigris`](https://github.com/walkerke/tigris) and then join it to the non-spatial data from `tidycensus`. – austensen Nov 28 '17 at 17:37
  • I don't think it needs to be one of the geographies listed from that link. "tract" and "county" from my examples both work and they aren't in that table in the link. – Chris Kiniry Nov 28 '17 at 21:08

2 Answers2

19

Edit 2018/05/09: I've published documentation that covers the available geographies in tidycensus and how to specify them, which you can read here: https://walkerke.github.io/tidycensus/articles/basic-usage.html#geography-in-tidycensus


I'm the author of the tidycensus package. Yes, I agree that this needs more documentation and I am currently writing it - stay tuned.

In the meantime, use this page for guidance: https://api.census.gov/data/2016/acs/acs5/geography.html. If you format the geography argument as spelled on this page, standalone geographies will work. Geographies that nest within states and/or counties will also work if the state and/or county arguments are specified correctly.

Geographies that a) are not standalone geographies in the API and b) do not nest within states and/or counties, like metropolitan divisions, are not currently supported. I would consider feature requests at https://github.com/walkerke/tidycensus/issues if there is a specific geography you need. Alternatively, the censusapi package (https://github.com/hrecht/censusapi) allows you to send highly customized queries to the Census API, so you might consider checking out this package.

kwalkertcu
  • 1,011
  • 6
  • 8
6

The ones I know work so far are as follows:

  1. "state"
  2. "county"
  3. "county subdivision"
  4. "place"
  5. "tract"
  6. "block group" (specify state and county)
  7. "congressional district"
  8. "State Legislative District (Upper Chamber)"
  9. "State Legislative District (Lower Chamber)"
  10. "zip code tabulation area" (do not put a state in or it errors)
  11. "zcta" (same data as the above)

Capitalization doesn't seem to matter and some require state or state/county to be specified.

Source: GEOID Structure for Geographic Areas at https://www.census.gov/geo/reference/geoidentifiers.html

erebusgw
  • 67
  • 4
  • 1
    Thank you erebusgw. I'm still trying to find a complete answer. Going through the github issues I found 2 other options beyond your list: "us" and "metropolitan statistical area/micropolitan statistical area". https://github.com/walkerke/tidycensus/issues/45 / https://github.com/walkerke/tidycensus/issues/29 – Chris Kiniry Nov 30 '17 at 14:49
  • One of those issues links to this page census page: https://api.census.gov/data/2015/acs/acs5/geography.html BUT I'm still not able to access metropolitan division. I wish the documentation was little better. – Chris Kiniry Nov 30 '17 at 14:50
  • Also "block" which is different from "block group" and isn't as available. – jesstme Dec 20 '17 at 05:19