pm_city_parse: Parse City Names

Description Usage Arguments Value

View source: R/city.R

Description

Parse a city name or abbreviation from a string. These data should be at the end of the string (i.e. the last several words). If a state name or abbrevation follows the city, use pm_state_parse first to remove those data from pm.address. Likewise, if a postal code follows a name, use pm_postal_parse first to remove those data from pm.address.

Usage

1
pm_city_parse(.data, dictionary, locale = "us")

Arguments

.data

A postmastr object created with pm_prep

dictionary

A tbl created with pm_dictionary to be used as a master list for cities.

locale

A string indicating the country these data represent; the only current option is "us" but this is included to facilitate future expansion.

Value

A tibble with a new character variable pm.city that contains the city name. If a city name is not detected in the string, a value of NA will be returned. If it does not yet exist, a copy of the address variable will be created in pm.address and returned with state name or abbreviation removed.


chris-prener/postmastr documentation built on Dec. 13, 2020, 3:39 a.m.