Skip to contents

taf_needed_counties() uses taf_catalog() to identify county TAF files that may contain address ranges for ZIP codes in x. For addr input it includes selected place, county-subdivision, and typographical ZIP candidates when requested. Character input contains ZIP codes only, so place-derived candidates cannot be inferred. taf_ensure() installs any needed counties that are not already present in the local TAF manifest.

Usage

taf_needed_counties(
  x,
  year = as.character(2025:2011),
  version = "v2",
  zip_variants = TRUE,
  zip_variant = c("minus1", "plus1", "sub5", "sub4", "swap"),
  place_zip_variants = TRUE,
  place_zip_variant = c("place", "county-sub")
)

taf_ensure(
  x,
  year = as.character(2025:2011),
  version = "v2",
  zip_variants = TRUE,
  zip_variant = c("minus1", "plus1", "sub5", "sub4", "swap"),
  place_zip_variants = TRUE,
  place_zip_variant = c("place", "county-sub"),
  redownload = FALSE
)

Arguments

x

an addr vector (?as_addr) or character vector of ZIP codes

year

character, length 1; vintage of TIGER addrfeat (address feature) files

version

character, length 1; major version of the package and taf dataset schema

zip_variants

logical; fuzzy match to common variants of x in y?

zip_variant

character vector; zipcode variant types to use when zip_variants is TRUE; see ?zipcode_variant

place_zip_variants

logical; for addr input, consider ZCTAs associated with the normalized input place or county subdivision?

place_zip_variant

nonempty character vector containing "place" and/or "county-sub"; requested order determines precedence

redownload

logical, length 1; replace existing durable managed local copies of TIGER ZIP files?

Value

taf_needed_counties() returns a tibble with catalog columns plus source_zip and source_zip_variant. taf_ensure() invisibly returns the subset of needed counties that were missing before installation.

Examples

taf_needed_counties(as_addr("10 MAIN ST CINCINNATI OH 45220"))
#> # A tibble: 39 × 7
#>    county_fips ZIP   zip3  zip2  n_ranges source_zip source_zip_variant
#>    <chr>       <chr> <chr> <chr>    <int> <chr>      <chr>             
#>  1 39061       45220 452   20         672 45220      exact             
#>  2 39061       45202 452   02        2088 45220      place             
#>  3 39061       45203 452   03         283 45220      place             
#>  4 39061       45204 452   04         610 45220      place             
#>  5 39061       45205 452   05         855 45220      place             
#>  6 39061       45206 452   06         940 45220      place             
#>  7 39061       45207 452   07         377 45220      place             
#>  8 39061       45208 452   08        1217 45220      place             
#>  9 39061       45209 452   09         595 45220      place             
#> 10 39061       45211 452   11        1813 45220      place             
#> # ℹ 29 more rows