Skip to content

Commit

Permalink
update to use 2022 CB files
Browse files Browse the repository at this point in the history
  • Loading branch information
walkerke committed Apr 22, 2023
1 parent 9e76bf4 commit 0da8e99
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
35 changes: 19 additions & 16 deletions R/estimates.R
Original file line number Diff line number Diff line change
Expand Up @@ -558,22 +558,25 @@ get_estimates <- function(geography = c("us", "region", "division", "state", "co

} else {

if (year > 2021) {
geom <- try(suppressMessages(use_tigris(geography = geography, year = 2021,
state = state, county = county, ...)))

if (geography == "county" && "09" %in% stringr::str_sub(geom$GEOID, 1, 2)) {
ct_2022 <- clean_connecticut()

geom <- geom %>%
dplyr::filter(!stringr::str_sub(GEOID, 1, 2) == "09") %>%
dplyr::bind_rows(ct_2022)
}

} else {
geom <- try(suppressMessages(use_tigris(geography = geography, year = year,
state = state, county = county, ...)))
}
geom <- try(suppressMessages(use_tigris(geography = geography, year = year,
state = state, county = county, ...)))

# if (year > 2021) {
# geom <- try(suppressMessages(use_tigris(geography = geography, year = 2021,
# state = state, county = county, ...)))
#
# if (geography == "county" && "09" %in% stringr::str_sub(geom$GEOID, 1, 2)) {
# ct_2022 <- clean_connecticut()
#
# geom <- geom %>%
# dplyr::filter(!stringr::str_sub(GEOID, 1, 2) == "09") %>%
# dplyr::bind_rows(ct_2022)
# }
#
# } else {
# geom <- try(suppressMessages(use_tigris(geography = geography, year = year,
# state = state, county = county, ...)))
# }



Expand Down
6 changes: 3 additions & 3 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use_tigris <- function(geography, year, cb = TRUE, resolution = "500k",
state = NULL, county = NULL, starts_with = NULL, ...) {

# Handle missing 2022 CB files for now
if (year == 2022) {
year <- 2021
}
# if (year == 2022) {
# year <- 2021
# }

if (year %in% 2011:2012) {
cb <- FALSE
Expand Down

0 comments on commit 0da8e99

Please sign in to comment.