Determine the presence of unit types within a string.

pm_has_unit(.data, dictionary, scalar = TRUE, locale = "us")

Arguments

.data

A postmastr object (created with pm_prep)

dictionary

Optional; a tbl created with pm_dictionary to be used as a master list for unit names. If none is provided, the pm_dic_units object will be used as the default dictionary

scalar

If TRUE, a single logical scalar is returned; otherwise if FALSE, a logical vector is returned.

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 logical variable pm.hasUnit that is TRUE if a state name or abbreviation is found in the address and FALSE otherwise.

If scalar = TRUE, a single logical scalar is returned that is TRUE if the data contain statenames or abbreviations and FALSE if they do not. If scalar = FALSE a tibble with a new logical variable pm.hasUnit that is TRUE if a unit types is found in the address and FALSE otherwise.