From 3562dcc7fa74c87e0551fc803c8213272aac123e Mon Sep 17 00:00:00 2001 From: Kyle Walker Date: Fri, 20 Sep 2024 11:58:49 -0500 Subject: [PATCH] fix #570 --- DESCRIPTION | 2 +- R/helpers.R | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f01d3ec..8c31155 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,7 +6,7 @@ Authors@R: c( person(given = "Kyle", family = "Walker", email="kyle@walker-data.com", role=c("aut", "cre")), person(given = "Matt", family = "Herman", email = "mfherman@gmail.com", role = "aut"), person(given = "Kris", family = "Eberwein", email = "eberwein@knights.ucf.edu", role = "ctb")) -Date: 2024-09-19 +Date: 2024-09-20 URL: https://walker-data.com/tidycensus/ BugReports: https://github.com/walkerke/tidycensus/issues Description: An integrated R interface to several United States Census Bureau diff --git a/R/helpers.R b/R/helpers.R index 7daec2b..ba3cc93 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -212,8 +212,8 @@ use_tigris <- function(geography, year, cb = TRUE, resolution = "500k", } else if (geography == "metropolitan statistical area/micropolitan statistical area" || geography == "cbsa") { - # 2022 CBSA files for CB not yet available - if (cb && year == 2022) { + # 2022 CBSA files not available + if (year == 2022) { year <- 2021 } @@ -314,7 +314,12 @@ use_tigris <- function(geography, year, cb = TRUE, resolution = "500k", } else if (geography == "combined statistical area") { - csa <- combined_statistical_areas(cb = cb, class = "sf", year = year, ...) + # CSA file not published for '22, so we need '21 geometries + if (year == 2022) { + csa <- combined_statistical_areas(cb = cb, class = "sf", year = 2021, ...) + } else { + csa <- combined_statistical_areas(cb = cb, class = "sf", year = year, ...) + } return(csa)