Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error : Your API call has errors." when using get_decennial for some 2010 data #191

cshancock opened this issue Sep 13, 2019 · 2 comments


Copy link

@cshancock cshancock commented Sep 13, 2019

I have three similar calls for 1990, 2000, and 2010. However, only the 2010 call produces an error. The error is shown below; note that it includes a path to sf3:

Getting data from the 2010 decennial Census Using FIPS code '53' for state 'WA' Using FIPS code '063' for 'Spokane County' Error : Your API call has errors. The API message returned is <html><head><title>Error report</title></head><body><h1>HTTP Status 404 - /data/2010/dec/sf3</h1></body></html>. Error in gather_(data, key_col = compat_as_lazy(enquo(key)), value_col = compat_as_lazy(enquo(value)), : unused argument (-NAME)

My code is below; only spok_vacant_2010 produces the error. The call assigned to test works fine:

key <- c("my-valid-api-key")
census_api_key(key, install = TRUE, overwrite = TRUE) 
readRenviron("~/.Renviron") # restarts R session in order to use tidycensus api key

spok_vacant_1990 <- get_decennial(geography = "tract", variables = "H0050001",
                                 county = "Spokane", year = 1990, state = "WA")

spok_vacant_2000 <- get_decennial(geography = "tract", variables = "H005001",
                                 county = "Spokane", year = 2000, state = "WA")

spok_vacant_2010 <- get_decennial(geography = "tract", variables = "H0050001",
                                  county = "Spokane", year = 2010, state = "WA",
                                  key = key, sumfile = "sf1")

test <- get_decennial(geography = "tract", variables = "H006005",
                                  county = "Spokane", year = 2010, state = "WA",
                                  key = key)

The economic census began uploading today; maybe that's part of the issue? The error suggests the API call is being made to sf3.


This comment has been minimized.

Copy link

@UrbanPlanner42 UrbanPlanner42 commented Sep 17, 2019

I am getting the same error :-(


This comment has been minimized.

Copy link

@walkerke walkerke commented Sep 17, 2019

A while back Census changed the variable names for many variables from the decennial Census via the API. This means that old code with the old variable names won't work. Generally, the new names have zeroes removed from the interior - which is the issue you are encountering. So, the following code works:

spok_vacant_2010 <- get_decennial(geography = "tract", variables = "H005001",
                                  county = "Spokane", year = 2010, state = "WA",
                                  key = key, sumfile = "sf1")

# A tibble: 105 x 4
   GEOID       NAME                                    variable value
   <chr>       <chr>                                   <chr>    <dbl>
 1 53063000200 Census Tract 2, Spokane County, Washin~ H005001    177
 2 53063000300 Census Tract 3, Spokane County, Washin~ H005001    133
 3 53063000400 Census Tract 4, Spokane County, Washin~ H005001    112
 4 53063000500 Census Tract 5, Spokane County, Washin~ H005001     68
 5 53063000600 Census Tract 6, Spokane County, Washin~ H005001     55
 6 53063000700 Census Tract 7, Spokane County, Washin~ H005001     99
 7 53063000800 Census Tract 8, Spokane County, Washin~ H005001     83
 8 53063000900 Census Tract 9, Spokane County, Washin~ H005001    115
 9 53063001000 Census Tract 10, Spokane County, Washi~ H005001    105
10 53063001100 Census Tract 11, Spokane County, Washi~ H005001     68

load_variables() is updated with the current names; I'd recommend grabbing the dataset again and updating your code with the new variable names.

@walkerke walkerke closed this Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.