Skip to content

Commit

Permalink
complete initial bump to 2023 support
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherkenny committed May 30, 2024
1 parent 21e6e8b commit 156ed72
Show file tree
Hide file tree
Showing 39 changed files with 84 additions and 64 deletions.
4 changes: 2 additions & 2 deletions R/address_ranges.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_address_ranges("DE", county = "001"))} # downloads slow on CRAN
tt_address_ranges <- function(state, county, year = 2022) {
tt_address_ranges <- function(state, county, year = 2023) {

years_okay(year, okay = 2011:2022)
years_okay(year, okay = 2011:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_adress_ranges}.")
Expand Down
2 changes: 1 addition & 1 deletion R/ai_an_nh_areas.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_ai_an_nh_areas())}
tt_ai_an_nh_areas <- function(year = 2022) {
tt_ai_an_nh_areas <- function(year = 2023) {

years_okay(year)

Expand Down
2 changes: 1 addition & 1 deletion R/anrc.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_anrc())} # downloads slow on CRAN
tt_anrc <- function(year = 2022) {
tt_anrc <- function(year = 2023) {

years_okay(year)

Expand Down
4 changes: 2 additions & 2 deletions R/area_landmarks.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_area_landmarks("DE"))} # downloads slow on CRAN
tt_area_landmarks <- function(state, year = 2022) {
tt_area_landmarks <- function(state, year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_area_landmarks}.")
Expand Down
4 changes: 2 additions & 2 deletions R/area_water.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_area_water("DE"))} # downloads slow on CRAN
tt_area_water <- function(state, county, year = 2022) {
tt_area_water <- function(state, county, year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_area_water}.")
Expand Down
2 changes: 1 addition & 1 deletion R/block_groups.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_block_groups(state = "DE", county = "001"))} # downloads slow on CRAN
tt_block_groups <- function(state, county, year = 2022) {
tt_block_groups <- function(state, county, year = 2023) {

years_okay(year)

Expand Down
2 changes: 1 addition & 1 deletion R/blocks.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_blocks(state = "DE", county = "001"))}
tt_blocks <- function(state, county, year = 2022) {
tt_blocks <- function(state, county, year = 2023) {

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_blocks}.")
Expand Down
4 changes: 2 additions & 2 deletions R/coastline.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_coastline())} # downloads slow on CRAN
#' }
tt_coastline <- function(year = 2022) {
tt_coastline <- function(year = 2023) {

years_okay(year, 2016:2022)
years_okay(year, 2016:2023)

zip_url <- glue::glue("{base_url(year)}/COASTLINE/tl_{year}_us_coastline.zip")
target <- paste0("tl_", year, "_us_coastline.shp")
Expand Down
2 changes: 1 addition & 1 deletion R/consolidated_cities.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_consolidated_cities("CT"))} # downloads slow on CRAN
tt_consolidated_cities <- function(state, year = 2022) {
tt_consolidated_cities <- function(state, year = 2023) {

years_okay(year)

Expand Down
2 changes: 1 addition & 1 deletion R/counties.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_counties(state = "DE"))} # downloads slow on CRAN
#' }
tt_counties <- function(state, year = 2022) {
tt_counties <- function(state, year = 2023) {

years_okay(year)

Expand Down
2 changes: 1 addition & 1 deletion R/county_subdivisions.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_county_subdivisions("DE"))} # downloads slow on CRAN
tt_county_subdivisions <- function(state, year = 2022) {
tt_county_subdivisions <- function(state, year = 2023) {

years_okay(year)

Expand Down
2 changes: 1 addition & 1 deletion R/elementary_school_districts.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_elementary_school_districts("AZ"))} # downloads slow on CRAN
tt_elementary_school_districts <- function(state, year = 2022) {
tt_elementary_school_districts <- function(state, year = 2023) {

years_okay(year)

Expand Down
4 changes: 2 additions & 2 deletions R/estates.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_estates())} # downloads slow on CRAN
tt_estates <- function(year = 2022) {
tt_estates <- function(year = 2023) {

years_okay(year, 2012:2022)
years_okay(year, 2012:2023)

zip_url <- glue::glue("{base_url(year)}/ESTATE/tl_{year}_78_estate.zip")
target <- glue::glue("tl_{year}_78_estate.shp")
Expand Down
4 changes: 2 additions & 2 deletions R/linear_water.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_linear_water("DE"))} # downloads slow on CRAN
tt_linear_water <- function(state, county, year = 2022) {
tt_linear_water <- function(state, county, year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_linear_water}.")
Expand Down
8 changes: 8 additions & 0 deletions R/lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ state_lookup <- function(state) {
st$fips[matched]
}

all_state_fips <- c("01", "02", "04", "05", "06",
"08", "09", "10", "11", "12", "13", "15", "16", "17", "18",
"19", "20", "21", "22", "23", "24", "25", "26", "27",
"28", "29", "30", "31", "32", "33", "34", "35", "36", "37",
"38", "39", "40", "41", "42", "44", "45", "46", "47",
"48", "49", "50", "51", "53", "54", "55", "56", "60", "66",
"69", "72", "74", "78")

county_lookup <- function(state, counties) {
st <- get("county_fips_2020")
st <- st[st$state %in% state, ]
Expand Down
4 changes: 2 additions & 2 deletions R/military.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_military())} # downloads slow on CRAN
tt_military <- function(year = 2022) {
tt_military <- function(year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

zip_url <- glue::glue("{base_url(year)}/MIL/tl_{year}_us_mil.zip")
target <- glue::glue("tl_{year}_us_mil.shp")
Expand Down
4 changes: 2 additions & 2 deletions R/new_england_city.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_new_england_cities())} # downloads slow on CRAN
tt_new_england_cities <- function(year = 2022) {
tt_new_england_cities <- function(year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

dec_yr <- pad_str(year %% 2000 - (year %% 10))
url_adj <- ""
Expand Down
2 changes: 1 addition & 1 deletion R/places.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_places("DE"))} # downloads slow on CRAN
tt_places <- function(state, year = 2022) {
tt_places <- function(state, year = 2023) {

years_okay(year)

Expand Down
4 changes: 2 additions & 2 deletions R/point_landmarks.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_point_landmarks("DE"))} # downloads slow on CRAN
tt_point_landmarks <- function(state, year = 2022) {
tt_point_landmarks <- function(state, year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_point_landmarks}.")
Expand Down
4 changes: 2 additions & 2 deletions R/polygon_edges.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_polygon_edges("DE", county = "001"))} # downloads slow on CRAN
tt_polygon_edges <- function(state, county, year = 2022) {
tt_polygon_edges <- function(state, county, year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_roads}.")
Expand Down
4 changes: 2 additions & 2 deletions R/polygon_faces.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_polygon_faces("DE", county = "001"))} # downloads slow on CRAN
tt_polygon_faces <- function(state, county, year = 2022) {
tt_polygon_faces <- function(state, county, year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_roads}.")
Expand Down
4 changes: 2 additions & 2 deletions R/primary_roads.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_primary_roads())} # downloads slow on CRAN
#' }
tt_primary_roads <- function(year = 2022) {
tt_primary_roads <- function(year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

zip_url <- glue::glue("{base_url(year)}/PRIMARYROADS/tl_{year}_us_primaryroads.zip")
target <- glue::glue("tl_{year}_us_primaryroads.shp")
Expand Down
4 changes: 2 additions & 2 deletions R/primary_secondary_roads.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_primary_secondary_roads("DE"))} # downloads slow on CRAN
tt_primary_secondary_roads <- function(state, year = 2022) {
tt_primary_secondary_roads <- function(state, year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_primary_secondary_roads}.")
Expand Down
14 changes: 10 additions & 4 deletions R/puma.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_puma("DE"))} # downloads slow on CRAN
tt_puma <- function(state, year = 2021) {
tt_puma <- function(state, year = 2023) {

years_okay(year, 2012:2021)
years_okay(year, 2012:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_puma}.")
}
state <- state_lookup(state)

if (year > 2021) {
dec_yr <- '20'
} else{
dec_yr <- '10'
}

shp <- lapply(state, function(st) {
zip_url <- glue::glue("{base_url(year)}/PUMA/tl_{year}_{st}_puma10.zip")
target <- glue::glue("tl_{year}_{st}_puma10.shp")
zip_url <- glue::glue("{base_url(year)}/PUMA/tl_{year}_{st}_puma{dec_yr}.zip")
target <- glue::glue("tl_{year}_{st}_puma{dec_yr}.shp")
tt_download_read(url = zip_url, target_file = target)
})
shp <- do.call(rbind, shp)
Expand Down
4 changes: 2 additions & 2 deletions R/rails.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_rails())} # downloads slow on CRAN
#' }
tt_rails <- function(year = 2022) {
tt_rails <- function(year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

zip_url <- glue::glue("{base_url(year)}/RAILS/tl_{year}_us_rails.zip")
target <- glue::glue("tl_{year}_us_rails.shp")
Expand Down
4 changes: 2 additions & 2 deletions R/roads.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_roads("DE"))} # downloads slow on CRAN
tt_roads <- function(state, county, year = 2022) {
tt_roads <- function(state, county, year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

if (missing(state)) {
cli::cli_abort("{.arg state} is required for {.fn tt_roads}.")
Expand Down
2 changes: 1 addition & 1 deletion R/secondary_school_districts.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_secondary_school_districts("AZ"))} # downloads slow on CRAN
tt_secondary_school_districts <- function(state, year = 2022) {
tt_secondary_school_districts <- function(state, year = 2023) {

years_okay(year)

Expand Down
2 changes: 1 addition & 1 deletion R/state_leg_lower.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_state_leg_lower("DE"))} # downloads slow on CRAN
tt_state_leg_lower <- function(state, year = 2022) {
tt_state_leg_lower <- function(state, year = 2023) {

years_okay(year)

Expand Down
2 changes: 1 addition & 1 deletion R/state_leg_upper.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_state_leg_lower("DE"))} # downloads slow on CRAN
tt_state_leg_upper <- function(state, year = 2022) {
tt_state_leg_upper <- function(state, year = 2023) {

years_okay(year)

Expand Down
2 changes: 1 addition & 1 deletion R/states.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_states())}
tt_states <- function(year = 2022) {
tt_states <- function(year = 2023) {

years_okay(year)

Expand Down
4 changes: 2 additions & 2 deletions R/subbarrio.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_subbarrios())} # downloads slow on CRAN
tt_subbarrios <- function(year = 2022) {
tt_subbarrios <- function(year = 2023) {

years_okay(year, 2016:2022)
years_okay(year, 2016:2023)

zip_url <- glue::glue("{base_url(year)}/SUBBARRIO/tl_{year}_72_subbarrio.zip")
target <- paste0("tl_", year, "_72_subbarrio.shp")
Expand Down
2 changes: 1 addition & 1 deletion R/tract.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_tracts(state = "DE", county = "001"))} # downloads slow on CRAN
tt_tracts <- function(state, county, year = 2022) {
tt_tracts <- function(state, county, year = 2023) {

years_okay(year)

Expand Down
4 changes: 2 additions & 2 deletions R/tribal_block_groups.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_tribal_block_groups())}
tt_tribal_block_groups <- function(year = 2022) {
tt_tribal_block_groups <- function(year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

dec_yr <- pad_str(year %% 2000 - (year %% 10))
url_adj <- ""
Expand Down
4 changes: 2 additions & 2 deletions R/tribal_subdivisions.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_tribal_subdivisions())}
tt_tribal_subdivisions <- function(year = 2022) {
tt_tribal_subdivisions <- function(year = 2023) {

years_okay(year, 2015:2022)
years_okay(year, 2015:2023)

zip_url <- glue::glue("{base_url(year)}/AITSN/tl_{year}_us_aitsn.zip")
target <- paste0("tl_", year, "_us_aitsn.shp")
Expand Down
4 changes: 2 additions & 2 deletions R/tribal_tracts.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @examples
#' # Wrapped in try due to false positive 304 errors
#' \donttest{try(tt_tribal_tracts())}
tt_tribal_tracts <- function(year = 2022) {
tt_tribal_tracts <- function(year = 2023) {

years_okay(year, 2010:2022)
years_okay(year, 2010:2023)

dec_yr <- pad_str(year %% 2000 - (year %% 10))
url_adj <- ""
Expand Down
Loading

0 comments on commit 156ed72

Please sign in to comment.