Take US phone numbers in any number of formats and try to convert them to a standard format.
normal_phone(
number,
format = "(%a) %e-%l",
na_bad = FALSE,
convert = FALSE,
rm_ext = FALSE
)
A vector of phone number in any format.
The desired output format, with %a
representing the 3-digit
area code, %e
representing the 3-digit exchange, and %l
representing the 4-digit line number. The punctuation between each part
of the format is used in the normalized number (e.g., "(%a) %e-%l"
or
"%a-%e-%l"
).
logical; Should invalid numbers be replaced with NA
.
logical; Should keypad_convert()
be invoked to replace
numbers with their keypad equivalent.
logical; Should extensions be removed from the end of a number.
A normalized telephone number.
normal_phone(number = c("916-225-5887"))
#> [1] "(916) 225-5887"