Comments (11)
Thanks, this will be a quick fix. The issue is with the geometry for those years, so if you set geometry
to FALSE
it'll work for now. I'll get this taken care of shortly.
from tidycensus.
This is fixed in 02e3b11. tidycensus uses the cartographic boundary files available from tigris by default, but can fetch the regular TIGER/Line files with the keyword argument cb = FALSE
. However, cartographic boundary files do not exist for 2011 and 2012, so tidycensus now uses the TIGER/Line files by default for those years.
from tidycensus.
I'm getting a similar error for Detroit's metro area. Setting cb = F
returns geometries without error, but I'm confused as to why we're still seeing this error for the default year?
dma <- get_acs(
geography = 'block group'
,state = 'MI'
,county = c('Oakland', 'Macomb', 'Wayne')
,variables = c('B22010_001E','B22010_002E')
,geometry = T
,output = 'wide'
,cb = T # throws an error if TRUE!
)
Getting data from the 2013-2017 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Getting data from the 2013-2017 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using FIPS code '26' for state 'MI'
Using FIPS code '125' for 'Oakland County'
Cannot open layer cb_2017_26_bg_500k
Error in CPL_read_ogr(dsn, layer, query, as.character(options), quiet, :
Opening layer failed.
In addition: Warning message:
In unzip(file_loc, exdir = tmp) : error 1 in extracting from zip file
Setting cb = F
is working for me.
dma <- get_acs(
geography = 'block group'
,state = 'MI'
,county = c('Oakland', 'Macomb', 'Wayne')
,variables = c('B22010_001E','B22010_002E')
,geometry = T
,output = 'wide'
,cb = F # throws an error if TRUE!
)
Getting data from the 2013-2017 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Getting data from the 2013-2017 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using FIPS code '26' for state 'MI'
Using FIPS code '125' for 'Oakland County'
Getting data from the 2013-2017 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using FIPS code '26' for state 'MI'
Using FIPS code '099' for 'Macomb County'
Getting data from the 2013-2017 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using FIPS code '26' for state 'MI'
Using FIPS code '163' for 'Wayne County'
from tidycensus.
@philiporlando thanks for bringing this up. I've also been experiencing similar behavior intermittently, though I just ran your problem code successfully.
Specifically, connections to the Census shapefiles via httr GET requests (which is used deep under the hood here) have been known to occasionally fail. I've generally noticed these errors when R is used in a server environment - both on Windows and Linux. I've pinged Census about this, but the error has been tough to isolate as they've had to dig through server logs and the problem generally goes away.
Give it another try and hopefully it'll work as it did for me. If not I'll touch base with Census again.
from tidycensus.
I've been getting this error as well, even on the latest version of R (3.5.1), the ACS 5-year published in 2010, 2011, 2012, 2013, and 2014.
> get_acs(geography = "place",
state = "NY",
variables = c("B01003_001E"),
year = 2013,
survey = "acs5",
geometry = FALSE)
Getting data from the 2009-2013 5-year ACS
Using FIPS code '36' for state 'NY'
Client error Not Found Client error: (404) Not Found
Error in as.character(x) :
cannot coerce type 'closure' to vector of type 'character'
from tidycensus.
Hi @jonoyuan, I just ran this code succesfully. It could be that Census API was experiencing problems or your internet connectivity was spotty when you tried to run it.
library(tidycensus)
get_acs(geography = "place",
state = "NY",
variables = c("B01003_001E"),
year = 2013,
survey = "acs5",
geometry = FALSE)
#> Getting data from the 2009-2013 5-year ACS
#> # A tibble: 1,190 x 5
#> GEOID NAME variable estimate moe
#> <chr> <chr> <chr> <dbl> <dbl>
#> 1 3600155 Accord CDP, New York B01003_001 873 487
#> 2 3600199 Adams village, New York B01003_001 1769 277
#> 3 3600232 Adams Center CDP, New York B01003_001 2286 383
#> 4 3600276 Addison village, New York B01003_001 1840 154
#> 5 3600342 Afton village, New York B01003_001 1048 184
#> 6 3600408 Airmont village, New York B01003_001 8692 34
#> 7 3600441 Akron village, New York B01003_001 2862 18
#> 8 3601000 Albany city, New York B01003_001 98142 70
#> 9 3601011 Albertson CDP, New York B01003_001 5260 481
#> 10 3601033 Albion village, New York B01003_001 5595 285
#> # ... with 1,180 more rows
Created on 2019-04-24 by the reprex package (v0.2.1)
from tidycensus.
I am trying to retrieve some data from ACS but I keep getting error just for specific tables, see below
life_phy_ssc_var <- c("C24010_010"," C24010_046")
life_phy_ssc_DC <- get_acs(geography = "County", variables = life_phy_ssc_var, state="DC", year=2018)
Getting data from the 2014-2018 5-year ACS
Using FIPS code '11' for state 'DC'
No encoding supplied: defaulting to UTF-8.
Error: Your API call has errors. The API message returned is .
from tidycensus.
the for census tract
life_phy_ssc_var <- c("C24010_010"," C24010_046")
life_phy_ssc <- get_acs(geography = "tract", variables = life_phy_ssc_var, state="DC", geometry = TRUE, year=2018)
Getting data from the 2014-2018 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set options(tigris_use_cache = TRUE)
.
Using FIPS code '11' for state 'DC'
No encoding supplied: defaulting to UTF-8.
Error: Your API call has errors. The API message returned is .
from tidycensus.
@jefunes your code works fine for me once the space is removed prior to the second variable (you're sending the space to the API in the variable name which it is not understanding).
That said I was unable to reproduce your first error. Could you make sure all of your packages are updated? If that does not solve it, could you paste the results of your sessionInfo()
here?
from tidycensus.
space made a difference
from tidycensus.
thanks!
from tidycensus.
Related Issues (20)
- voting district geography incompatible with dhc tables? HOT 2
- Is getting geographies and data from different years possible? HOT 1
- congressional district from ACS1 giving an error HOT 2
- Bug with get_estimates and 2021 vintage data HOT 8
- Possible Issue with get_decennial block level variables HOT 1
- Conversion of East and West longitudes for US Census Tract 02016 in Alaska HOT 2
- Question: ACS 2018-2022 HOT 2
- 2022 ACS will require 2023 TIGER geometries for congressional districts HOT 3
- Need to update `geography` column for 2018-2022 ACS variables
- get_acs() - Is there a limit of ZCTAs one can pass for the zcta argument given geography="zcta"? HOT 1
- "dp" dataset not working HOT 2
- Clarify replicate weights method for pums data HOT 3
- "HISP" breakdown labels in `get_estimates(geography = "state")` return miscoded HOT 2
- `puma` argument not working with 5-year 2018-2022 ACS PUMS HOT 7
- get_pums and/or Census API issue HOT 4
- Add documentation to load_variables() about datasets
- geography column empty for load_variables() for 2022 ACS 5-year estimate variables HOT 1
- return_vacant and 'VACS' variable not working for get_pums HOT 4
- Failed with error: ‘lazy-load database 'C:/R/win-library/4.0/tidycensus/data/Rdata.rdb' is corrupt’ HOT 2
- rate_sleep() error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tidycensus.