Description Usage Arguments Value Examples
View source: R/numberToLetter.R
Take a character vector (i.e., a telephone number) and convert it to all all possible letter combinations as on from a telephone's key pad
1 | numberToLetter(value, decreasing = FALSE, qz = 1)
|
value |
An input value as a character vector with one element (a string) |
decreasing |
Whether to sort the results in alphabetical order or not |
qz |
Whether to assign q and z to zero (qz = 0) or not (any other value) |
A character vector of letters and dashes based on value
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Convert a string or a vector of numeric characters
numberToLetter("911") # returns "W11" "X11" "Y11" "Z11"
x <- "911"
numberToLetter(x) # also returns "W11" "X11" "Y11" "Z11"
# Convert a number directly
numberToLetter(911) # also returns "W11" "X11" "Y11" "Z11"
# Convert an alphanumeric string (letters are returned as is and
# non-alphanumeric characters are returned as dashes)
numberToLetter("dial 911!") # returns "DIAL-W11-" "DIAL-X11-" "DIAL-Y11-" "DIAL-Z11-"
# Specifying qz = 0 maps "q" and "z" to 0 instead of 7 and 9
numberToLetter("000") # returns "000"
numberToLetter("000", qz = 0) # returns "QQQ" "QQZ" "QZQ" "QZZ" "ZQQ" "ZQZ" "ZZQ" "ZZZ"
|
[1] "W11" "X11" "Y11" "Z11"
[1] "W11" "X11" "Y11" "Z11"
[1] "W11" "X11" "Y11" "Z11"
[1] "DIAL-W11-" "DIAL-X11-" "DIAL-Y11-" "DIAL-Z11-"
[1] "000"
[1] "QQQ" "QQZ" "QZQ" "QZZ" "ZQQ" "ZQZ" "ZZQ" "ZZZ"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.