Issue downloading block-level data from the 2010 decennial, summary file sf1
get_decennial is not working for the following parameters:
geography <- "block"
year <- 2010
sumfile <- "sf1"
other values of geography, ie tract, work just fine other years work, ie 2000, work just fine the values input for state, variables or any other parameters don't appear to make a difference.
when using get_decennial for block level 2010 sf1 data, the command runs but returns an empty data table.
Thank you for looking into this!
For example, this returns an empty table.
tidycensus::get_decennial(geography="block", variables="P012003", year="2010", sumfile="sf1", state="50")
And this throws an error:
tidycensus::get_decennial(geography="block", variables="P012003", year="2010", sumfile="sf1", state="50", county="50001")
Error message:
Error in map_chr(county, function(x) { :
ℹ In index: 1.
Caused by error in validate_county():
! lazy-load database 'C:\Users\cnoelke\AppData\Local\R\win-library\4.4\tidycensus/data/Rdata.rdb' is corrupt
In addition: Warning messages:
1: In validate_county(state, x) :
restarting interrupted promise evaluation
2: In validate_county(state, x) :
internal error 1 in R_decompress1 with libdeflate
Using Census Summary File 1
Error in get_decennial():
! Error in map_chr(county, function(x) { :
ℹ In index: 1.
Caused by error in validate_county():
! lazy-load database 'C:\Users\cnoelke\AppData\Local\R\win-library\4.4\tidycensus/data/Rdata.rdb' is corrupt
packageVersion("tidycensus") [1] ‘1.6.7’ version _
platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 4.0
year 2024
month 04
day 24
svn rev 86474
language R
version.string R version 4.4.0 (2024-04-24 ucrt) nickname Puppy Cup
Unfortunately, the Census API has removed the ability to get block-level data by state in the 2010 Census. We'll need to either iterate over counties or throw an error in the next release.
Regarding your code @cnoelke, you don't need to specify the state code as part of the county code. This works:
tidycensus::get_decennial(geography="block",
variables="P012003",
year="2010",
sumfile="sf1",
state="50", county="001")
Getting data from the 2010 decennial Census
Using Census Summary File 1
# A tibble: 2,100 × 4
GEOID NAME variable value
<chr> <chr> <chr> <dbl>
1 500019601001051 Block 1051, Block Group 1, Census Tract 9… P012003 0
2 500019601001052 Block 1052, Block Group 1, Census Tract 9… P012003 0
3 500019601001028 Block 1028, Block Group 1, Census Tract 9… P012003 0
4 500019601001033 Block 1033, Block Group 1, Census Tract 9… P012003 1
5 500019601001034 Block 1034, Block Group 1, Census Tract 9… P012003 0
6 500019601001035 Block 1035, Block Group 1, Census Tract 9… P012003 0
7 500019601001044 Block 1044, Block Group 1, Census Tract 9… P012003 0
8 500019601001002 Block 1002, Block Group 1, Census Tract 9… P012003 3
9 500019601001019 Block 1019, Block Group 1, Census Tract 9… P012003 0
10 500019601001003 Block 1003, Block Group 1, Census Tract 9… P012003 0
# ℹ 2,090 more rows
# ℹ Use `print(n = ...)` to see more rows
Confirming that state-by-county download is working. Gotta add that extra county loop now. Thank you, Kyle!