Return consistent version of a state abbreviations using stringr::str_*()
functions. Letters are capitalized, all non-letters characters are removed,
and excess whitespace is trimmed and squished, and then abbrev_full() is
called with usps_state.
normal_state(
state,
abbreviate = TRUE,
na = c("", "NA"),
na_rep = FALSE,
valid = NULL
)A vector of US state names or abbreviations.
If TRUE (default), replace state names with the 2-digit
abbreviation using the built-in state.abb and state.name vectors.
A vector of values to make NA.
logical; If TRUE, make all single digit repeating strings
NA (removes valid "AA" code for "American Armed Forces").
A vector of valid abbreviations to compare to and remove those not shared.
A vector of normalized 2-digit state abbreviations.
Other geographic normalization functions:
abbrev_full(),
abbrev_state(),
check_city(),
expand_abbrev(),
expand_state(),
fetch_city(),
normal_address(),
normal_city(),
normal_zip(),
str_normal()