Closed chrismp closed 6 years ago
Hi, the 2010 Decennial SF1 API supports ZCTAs as a region within a state. So, adding a regionin
argument will make your code work.
You can see this API's geography hierarchy by running:
geos <- listCensusMetadata(name = "sf1", vintage = 2010, type = "geographies")
This table details that state
is required for zip code tabulation area
. (It would be great if this were all written up in the Census documentation too, but the metadata is the best place to look for now.)
So with that, run this for your state of choice:
getCensus(
name = "sf1",
vars = c("P0010001"),
region = "zip code tabulation area:*",
regionin="state:4",
vintage = 2010,
)
Also - the key
argument defaults to Sys.getenv("CENSUS_KEY")
, so you can omit that argument if you prefer :)
Hey there, the following code...
...throws this error...
Error: error: unknown/unsupported geography heirarchy
.Any idea what I need to fix here so I can get 2010 population data for every ZCTA5? Replacing
"zip code tabulation area:*"
with `"county:*" works fine, by the way...