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")
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 thestate
and/orcounty
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.