zip_fips_lookup() uses a package-internal reference derived from the
2025 Q4 HUD USPS ZIP Code Crosswalk Files to translate between
a ZIP code and county FIPS identifiers.
Some ZIP codes are linked to multiple counties; also specify
the county FIPS identifier to get the USPS preferred city and
state names (in an addr_place() vector).
Usage
zip_fips_lookup(zip, fips = NULL)
Arguments
- zip
character, length one; a 5-digit ZIP code
- fips
character, length one; a 5-digit FIPS county identifier
Value
if fips is NULL, a character vector of matched 5-digit FIPS
county identifiers, ordered by percentages of residential addresses;
if fips is not NULL, an addr_place vector of length one
Examples
zip_fips_lookup(zip = "45220")
#> [1] "39061"
zip_fips_lookup(zip = "45249")
#> [1] "39061" "39165"
zip_fips_lookup(zip = "45249", fips = "39061")
#> <addr_place> function ()
#> @ name : chr "CINCINNATI"
#> @ state : chr "OH"
#> @ zipcode: chr "45249"