This function relies on usaddress python library https://usaddress.readthedocs.io/en/latest/ It can be installed to a python virtual environment specific to R with: py_install("usaddress", pip = TRUE) (See the README for more details on installing and managing non-system installations of python with reticulate.

tag_address(address, clean = TRUE)

Arguments

address

a character string that is a United States mailing address

clean

clean addresses with clean_address() prior to tagging?

Value

a tibble with street_number, street_name, city, state, and zip_code columns

Details

This function uses a custom tag mapping to combine address components into the columns in the returned tibble (see https://usaddress.readthedocs.io/en/latest/#details for full definition of components):

  • street_number: AddressNumber, AddressNumberPrefix, AddressNumberSuffix

  • street_name: StreetName, StreetNamePreDirectional, StreetNamePostDirectional, StreetNamePostModifier, StreetNamePostType

  • city: PlaceName

  • state: StateName

  • zip: the first five characters of ZipCode

If an address is not classified as a Street Address (i.e. Intersection, PO Box, or Ambiguous), then the columns in the returned component tibble will all be missing.