View source: R/keypad-convert.R
keypad_convert | R Documentation |
This function works best when converting numbers to letters, as each number only has a single possible letter. For each letter, there are 3 or 4 possible letters, resulting in a number of possible conversions. This function was intended to convert phonetic telephone numbers to their valid numeric equivalent; when used in this manner, each letter in a string can be lazily replaced without changing the rest of the string.
keypad_convert(x, ext = FALSE)
x |
A vector of characters or letters. |
ext |
logical; Should extension text be converted to numbers. Defaults to
|
When replacing letters, this function relies on the feature of
stringr::str_replace_all()
to work with named vectors (c("A" = "2")
).
If a character vector is supplied, a vector of each elements numeric counterpart is returned. If a numeric vector (or a completely coercible character vector) is supplied, then a list is returned, each element of which contacts a vector of letters for each number.
keypad_convert("1-800-CASH-NOW ext123")
keypad_convert(c("abc", "123"))
keypad_convert(letters)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.