hrecht / censusapi

R package to retrieve U.S. Census data and metadata via API
https://www.hrecht.com/censusapi/
169 stars 31 forks source link

Error in listCensusMetadata #41

Closed aeonstone closed 6 years ago

aeonstone commented 6 years ago

I'm having an issue using the listlistCensusMetadata command when trying to access ACS data tables. The command works fine when using SAHIE or SAIPE data sets. I get the same error regardless of ACS1 or ACS5 and regardless of what vintage use (e.g. 2012 or 2015). Also I have the most current version of censusapi.

acs_var <- listCensusMetadata(name = "acs/acs5", vintage = 2016, type = "variables")
Error in rbind(deparse.level, ...) : 
  numbers of columns of arguments do not match
hrecht commented 6 years ago

Thanks for reporting this. What version of R are you using and what computer system? (If others are reading this issue, please see if you get the same error.)

I assume something has changed in the underlying JSON that the censusapi package is reading. I'll add a bug fix in to the next version. In the meantime, the same information can be browsed in the HTML version of the variable list at https://api.census.gov/data/2016/acs/acs5/variables.html

aeonstone commented 6 years ago

Thanks @hrecht for the quick reply. I am currently running R version 3.4.4 (2018-03-15) through Version 1.1.456 of of RStudio. And thanks for the tip on where to get the variable names.

fansi-sifan commented 6 years ago

Hey @hrecht I'm having a similar issue - R 3.5.0 on Windows

hrecht commented 6 years ago

Thanks all for the bug report, this has been fixed in version 0.4.1 with https://github.com/hrecht/censusapi/commit/a4b1e0b912818e8edb304ea6afb42fafec7019b6. The bug was caused by the Census Bureau renaming a metadata attribute that was used by the ACS and a few other endpoints.

You can install the new version now directly from github:

install.packages("devtools")
devtools::install_github("hrecht/censusapi")

v0.4.1 will also be submitted to CRAN in the near future.