Description Usage Arguments Value Examples
View source: R/letterToNumber.R
Take a character vector and convert it to the equivalent number sequence from a telephone's key pad
1 | letterToNumber(value, qz = 1)
|
value |
An input value as a character vector with one element (a string) |
qz |
Whether to assign q and z to zero (qz = 0) or not (any other value) |
A character vector of numbers 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 an alphabetic string can be converted directly (with
# non-alphanumeric characters replaced by dashes)
letterToNumber("R functions") # returns "7-386284667"
# Of course, vectors containing strings can also be converted
string <- "Phone Number"
letterToNumber(string) # returns "74663-686237"
# Alphanumeric strings can also be converted with numbers being returned as
# is
letterToNumber("Jenny's number is 867-5309") # returns "53669-7-686237-47-867-5309"
# Specifying qz = 0 maps "q" and "z" to 0 instead of 7 and 9
letterToNumber("qz") # returns "79"
letterToNumber("qz", qz = 0) # returns ("00")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.