Skip to contents

taf_needed_counties() uses taf_catalog() to identify county TAF files that may contain address ranges for ZIP codes in x, including selected ZIP code variants when requested. taf_ensure() installs any of those counties that are not already present in the local TAF manifest.

Usage

taf_needed_counties(
  x,
  year = as.character(2025:2011),
  version = "v1",
  zip_variants = TRUE,
  zip_variant = c("minus1", "plus1", "sub5", "sub4", "swap")
)

taf_ensure(
  x,
  year = as.character(2025:2011),
  version = "v1",
  zip_variants = TRUE,
  zip_variant = c("minus1", "plus1", "sub5", "sub4", "swap"),
  redownload = FALSE
)

Arguments

x

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

year

integer, length one; vintage of TIGER addrfeat (address feature) files

version

character, length one; 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

redownload

logical, length 1; re-download cached 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: 15 × 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       45219 452   19         930 45220      minus1            
#>  3 39061       45221 452   21           1 45220      plus1             
#>  4 39061       45221 452   21           1 45220      sub5              
#>  5 39061       45223 452   23        1078 45220      sub5              
#>  6 39061       45224 452   24        1163 45220      sub5              
#>  7 39061       45225 452   25         552 45220      sub5              
#>  8 39061       45226 452   26         647 45220      sub5              
#>  9 39061       45227 452   27        1768 45220      sub5              
#> 10 39061       45228 452   28           1 45220      sub5              
#> 11 39061       45229 452   29         707 45220      sub5              
#> 12 39017       45240 452   40           1 45220      sub4              
#> 13 39061       45210 452   10           4 45220      sub4              
#> 14 39061       45230 452   30        2024 45220      sub4              
#> 15 39061       45240 452   40        1585 45220      sub4