Closed sjcromer closed 1 year ago
Thanks! If you get the hierarchy error, it means that your requested geography is not available at that hierarchy. In this case, tract-level data are available by state, but you haven't supplied a state. So this works:
library(tidycensus)
ct_race <- get_decennial(
geography = 'tract',
state = 'CT',
variables = 'P013001',
year = 2010
)
#> Getting data from the 2010 decennial Census
#> Using Census Summary File 1
ct_race
#> # A tibble: 833 × 4
#> GEOID NAME variable value
#> <chr> <chr> <chr> <dbl>
#> 1 09009150300 Census Tract 1503, New Haven County, Connecticut P013001 43.3
#> 2 09009150600 Census Tract 1506, New Haven County, Connecticut P013001 42.5
#> 3 09009150700 Census Tract 1507, New Haven County, Connecticut P013001 42.6
#> 4 09009150900 Census Tract 1509, New Haven County, Connecticut P013001 45.1
#> 5 09009151000 Census Tract 1510, New Haven County, Connecticut P013001 46.2
#> 6 09009151100 Census Tract 1511, New Haven County, Connecticut P013001 44.2
#> 7 09009151200 Census Tract 1512, New Haven County, Connecticut P013001 46.2
#> 8 09009154100 Census Tract 1541, New Haven County, Connecticut P013001 35
#> 9 09009154200 Census Tract 1542, New Haven County, Connecticut P013001 32.9
#> 10 09009154500 Census Tract 1545, New Haven County, Connecticut P013001 33.5
#> # … with 823 more rows
Created on 2022-12-07 with reprex v2.0.2
ZCTAs can be requested for the entire US, so that's why the result is different.
I'd recommend reading the following section of my book for more info on this topic: https://walker-data.com/census-r/an-introduction-to-tidycensus.html#geography-and-variables-in-tidycensus
Hello! Thank you for this great package which I found from watching your Youtube tutorial.
I'm just getting started with ACS data and immediately encountered an issue with get_decennial() and get_acs(), both recognizing larger geographies (state, county, zcta) but not smaller geographies (tract, block). I am using the geography names you outlined here: https://walker-data.com/tidycensus/articles/basic-usage.html#geography-in-tidycensus Any advice?
Thanks for your help!