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
.
pm_city_parse(.data, dictionary, locale = "us")
.data | A postmastr object created with pm_prep |
---|---|
dictionary | A tbl created with |
locale | A string indicating the country these data represent; the only current option is "us" but this is included to facilitate future expansion. |
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.