Skip to content

Commit

Permalink
update population characteristics to 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
walkerke committed Jul 16, 2024
1 parent 0ebaeb5 commit d31937d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Binary file removed .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Package: tidycensus
Type: Package
Title: Load US Census Boundary and Attribute Data as 'tidyverse' and 'sf'-Ready Data Frames
Version: 1.6.4
Version: 1.6.5
Authors@R: c(
person(given = "Kyle", family = "Walker", email="[email protected]", role=c("aut", "cre")),
person(given = "Matt", family = "Herman", email = "[email protected]", role = "aut"),
person(given = "Kris", family = "Eberwein", email = "[email protected]", role = "ctb"))
Date: 2024-05-16
Date: 2024-07-16
URL: https://walker-data.com/tidycensus/
BugReports: https://github.com/walkerke/tidycensus/issues
Description: An integrated R interface to several United States Census Bureau
Expand Down
13 changes: 7 additions & 6 deletions R/estimates.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ get_estimates <- function(geography = c("us", "region", "division", "state", "co
rlang::abort("The only supported geographies at this time for population characteristics 2020 and later are 'state' and 'county'.")
}

if (vintage > 2022) {
rlang::abort("The Characteristics dataset has not yet been released for vintages beyond 2022")
if (vintage > 2023) {
rlang::abort("The Characteristics dataset has not yet been released for vintages beyond 2023")
}

if (geography == "state") {
Expand Down Expand Up @@ -156,17 +156,17 @@ get_estimates <- function(geography = c("us", "region", "division", "state", "co

} else if (geography == "county") {

if (vintage > 2022) {
if (vintage > 2023) {
rlang::abort("The county characteristics dataset for this vintage has not yet been released.")
}

if (!is.null(state)) {
state <- validate_state(state)

county_raw <- suppressMessages(readr::read_csv(sprintf("https://www2.census.gov/programs-surveys/popest/datasets/2020-2022/counties/asrh/cc-est2022-alldata-%s.csv", state)))
county_raw <- suppressMessages(readr::read_csv(sprintf("https://www2.census.gov/programs-surveys/popest/datasets/2020-%s/counties/asrh/cc-est%s-alldata-%s.csv", vintage, vintage, state)))

} else {
county_raw <- suppressMessages(readr::read_csv("https://www2.census.gov/programs-surveys/popest/datasets/2020-2022/counties/asrh/cc-est2022-all.csv"))
county_raw <- suppressMessages(readr::read_csv(sprintf("https://www2.census.gov/programs-surveys/popest/datasets/2020-%s/counties/asrh/cc-est%s-all.csv", vintage, vintage)))
}


Expand Down Expand Up @@ -234,7 +234,8 @@ get_estimates <- function(geography = c("us", "region", "division", "state", "co
dplyr::mutate(year = dplyr::case_when(
year == 2 ~ 2020L,
year == 3 ~ 2021L,
year == 4 ~ 2022L
year == 4 ~ 2022L,
year == 5 ~ 2023L
))

} else {
Expand Down

0 comments on commit d31937d

Please sign in to comment.