expand_abbrev {campfin} | R Documentation |
Expand Abbreviations
Description
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)
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., |
rep |
If |
Value
The vector x
with abbreviation replaced with their full version.
See Also
Other geographic normalization functions:
abbrev_full()
,
abbrev_state()
,
check_city()
,
expand_state()
,
fetch_city()
,
normal_address()
,
normal_city()
,
normal_state()
,
normal_zip()
,
str_normal()
Examples
expand_abbrev(x = "MT VERNON", abb = c("MT" = "MOUNT"))
expand_abbrev(x = "VT", abb = state.abb, rep = state.name)
expand_abbrev(x = "Low FE Level", abb = tibble::tibble(x = "FE", y = "Iron"))