expand_abbrev {campfin}R Documentation

Expand Abbreviations


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.


expand_abbrev(x, abb = NULL, rep = NULL)



A vector containing abbreviations.


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.


If abb is an unnamed vector, a vector of replacement strings for each abbreviation in abb.


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()


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"))

[Package campfin version 1.0.9 Index]