Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
get_historic_acs <- function (variables,
geography,
state = NULL,
year,
summary_var = NULL,
var_names) {
label <- var_names; variable <- variables
y <- list()
for (i in 1:length(year)) {
y[[i]] <- lapply(1:length(geography), function (x) {
tidycensus::get_acs (geography = geography[[x]],
variables = variables,
summary_var = summary_var,
output = "tidy", survey = 'acs1',
state = state[[x]],
year = year[i])}) %>%
bind_rows() %>%
mutate(year = year[i]) }
y %>%
bind_rows() %>%
left_join(data.frame(label, variable), stringsAsFactors = FALSE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.