Closed colingoodman closed 4 years ago
Looks like as of the 2016 ACS release, table B16002 was renamed to C16002.
library(tidycensus)
acs_instance <- get_acs(
geography = 'block group',
table = 'C16002',
state = 'Wyoming',
county = 'Weston'
)
#> Getting data from the 2014-2018 5-year ACS
acs_instance
#> # A tibble: 70 x 5
#> GEOID NAME variable estimate moe
#> <chr> <chr> <chr> <dbl> <dbl>
#> 1 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 685 97
#> 2 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 672 101
#> 3 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 5 10
#> 4 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 0 12
#> 5 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 5 10
#> 6 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 0 12
#> 7 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 0 12
#> 8 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 0 12
#> 9 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 8 14
#> 10 560459511~ Block Group 1, Census Tract 9511, Weston~ C16002_0~ 0 12
#> # ... with 60 more rows
Created on 2020-06-25 by the reprex package (v0.3.0)
@mfherman Thank you for catching that. What about table B18121? This table should be available, yet yields a result identical to my original post:
acs_instance <- get_acs(geography = 'block group', table = 'B18121', state = 'Kansas', county = 'Riley')
Error: Your API call has errors. The API message returned is .
Looks like that table is only available in the 1-year ACS estimates? I've found the easiest way to confirm which variables are in which survey is by using the load_variables()
function of tidycensus. Then you can search the table using the RStudio viewer or some string search functions.
library(tidycensus)
library(tidyverse)
acs5 <- load_variables(2018, "acs5", cache = TRUE)
acs1 <- load_variables(2018, "acs1", cache = TRUE)
acs5 %>%
filter(str_detect(name, "B18121"))
#> # A tibble: 0 x 3
#> # ... with 3 variables: name <chr>, label <chr>, concept <chr>
acs1 %>%
filter(str_detect(name, "B18121"))
#> # A tibble: 28 x 3
#> name label concept
#> <chr> <chr> <chr>
#> 1 B18121_~ Estimate!!Total WORK EXPERIENCE BY DISABI~
#> 2 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> 3 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> 4 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> 5 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> 6 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> 7 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> 8 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> 9 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> 10 B18121_~ Estimate!!Total!!Worked full-time, year ~ WORK EXPERIENCE BY DISABI~
#> # ... with 18 more rows
Created on 2020-06-25 by the reprex package (v0.3.0)
Yeah, it's a tricky thing to solve. We've had requests in the past for mappings of "which variables are available at which geographies" but this information isn't posted anywhere to my knowledge, and there are tens of thousands of variables to account for which we can't reasonably handle internally in tidycensus. I think @mfherman's suggestion is probably the best way to go here.
I am encountering an issue with get_acs() in which tidycensus does not provide a helpful error message.
The following example code:
acs_instance <- get_acs(geography = 'block group', table = 'B16002', state = 'Wyoming', county = 'Weston')
Results in the following:
I appreciate any help.