Create or use a named vector (c("abb" = "rep")) and pass it to
stringr::str_replace_all(). The abb argument is surrounded with \\b
to capture only isolated abbreviations. To be used inside
normal_address() and normal_city() with usps_street and usps_city,
respectively.
Usage
expand_abbrev(x, abb = NULL, rep = NULL)
Value
The vector x with abbreviation replaced with their full version.
Arguments
x
A vector containing abbreviations.
abb
One of three objects: (1) A dataframe with abbreviations in the
first column and corresponding replacement strings in the second
column; (2) a named vector, with abbreviations as names for their
respective replacements (e.g., c("abb" = "rep")); or (3) an unnamed
vector of abbreviations with an unnamed vector of replacements in the rep
argument.
rep
If abb is an unnamed vector, a vector of replacement strings for
each abbreviation in abb.