Reputation: 25
I am trying to get the 2010 census block group data using the function get_decennial()
from the tidycensus
package.
The function works fine for census tract and block, but not for block group.
This is the code that works fine for block level data.
b_10 <- get_decennial(geography = "block",
variables = "P001001",
year = 2010,
state = "WY",
county = "Teton",
geometry = FALSE)
This is the exact same code, which does not work. The only difference is that I changed from "block" to "block group" following the content from this article by Kyle Walker.
bg_10 <- get_decennial(geography = "block group",
variables = "P001001",
year = 2010,
state = "WY",
county = "Teton",
geometry = FALSE)
Here is the error message:
Getting data from the 2010 decennial Census Error : One or more of your requested variables is likely not available at the requested geography. Please refine your selection.
Error in gather_(data, key_col = compat_as_lazy(enquo(key)), value_col = compat_as_lazy(enquo(value)), : unused argument (-NAME)
The code also works fine with geography = "tract"
. Additionally, this code below works perfectly fine for getting the 2000 block group data.
bg_2000 <- get_decennial(geography = "block group",
year = 2000,
variables = "P001001",
state = "WY",
county = "Teton",
geometry = F)
So it seems like the problem is specific to block group of 2010. It would be great if someone can help me out!
Thank you very much.
Upvotes: 1
Views: 430
Reputation: 1061
It looks like Census disabled queries for all block groups within counties for the 2010 Census with the move to the new API endpoint. Blocks still work, however. For example:
https://api.census.gov/data/2010/dec/sf1?get=P001001,NAME&for=block:*&in=state:01%20county:073
works, whereas
does not.
Usually the API team is receptive to making these changes as requested. However, as the government is currently shut down, this won't happen until they are back to work.
Upvotes: 0