Closed ntdung96 closed 6 years ago
Thank you for the kind words!
getCensus()
is a function in the censusapi package, not tidycensus. Would you mind posting the code you tried that failed so I can check it?
So sorry, it must be get_acs()
. The code to pull data from census goes like this:
data = vector("list", 342)
for (i in 1:342) {
data[[i]] = get_acs(geography = "block group", table = table[i],
state = "VA", county = "Lynchburg city",
geometry = TRUE, keep_geo_vars = TRUE,
key = xxx)
}
Where table
is the vector of 342 table codes. get_acs()
throws me an error with the following tables:
'B99011','B99012','B99021','B99031','B99051','B99052','B99053','B99061','B99071','B99072','B99080', 'B99081','B99082','B99083','B99084','B99092','B99102','B99103','B99104','B99121','B99141', 'B99142', 'B99151','B99152','B99161','B99162','B99163','B99171','B99172','B99191','B99192','B99193','B99194', 'B99201','B99211','B99212','B99231','B99232','B99233','B99234','B99241','B99242','B99243', 'B992510', 'B992511','B992512','B992513','B992514','B992515','B992516','B992518', 'B992519', 'B99252', 'B992520','B992521','B992522','B99253','B99254','B99255','B99256','B99257','B99258','B99259'
It appears that all of those variables do not have associated margins of error; tidycensus was trying to request margins of error for those variables and failing. This should now be fixed; I've tested on your example but let me know if you have any issues.
Hello,
I have been exploring tidycensus lately when I work with the 2016 ACS 5-year data and your package is really nice. What I'm doing is to retrieve block-group level data for Lynchburg city in Virginia for 342 tables; the getCensus successfully retrieved most of them but failed about a dozen of the tables. I got the 400 Bad Request HTTP error.
Thanks, Dung