Skip to content

Instantly share code, notes, and snippets.

@floswald
Created April 12, 2019 18:00
Show Gist options
  • Save floswald/0ced80b77ee9eb904c1555578163a46d to your computer and use it in GitHub Desktop.
Save floswald/0ced80b77ee9eb904c1555578163a46d to your computer and use it in GitHub Desktop.
acs_catcher <- function(tbl, state, year=2017 ){
done = FALSE
while(!done){
out <- tryCatch(
{
x = get_acs(geography = "tract", state = state, table = tbl, year = year,keep_geo_vars = TRUE,cache_table = TRUE)
done = TRUE
return(x)
},
error = function(e) {
flog.error("repeating state %s",state)
done = FALSE
e}
)
}
return(out)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment