The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Title: Convert Letters to Numbers and Back as on a Telephone Keypad
Version: 0.2.3
Description: Convert English letters to numbers or numbers to English letters as on a telephone keypad. When converting letters to numbers, a character vector is returned with "A," "B," or "C" becoming 2, "D," "E", or "F" becoming 3, etc. When converting numbers to letters, a character vector is returned with multiple elements (i.e., "2" becomes a vector of "A," "B," and "C").
License: MIT + file LICENSE
URL: https://stevemyles.site/phonenumber/, https://github.com/scumdogsteev/phonenumber
BugReports: https://github.com/scumdogsteev/phonenumber/issues
Depends: R (≥ 3.1.3)
Suggests: knitr, rmarkdown, testthat
VignetteBuilder: knitr
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2021-05-01 17:26:40 UTC; steve
Author: Steve Myles [aut, cre]
Maintainer: Steve Myles <steve@mylesandmyles.info>
Repository: CRAN
Date/Publication: 2021-05-01 17:40:02 UTC

phonenumber: Convert letters to numbers and back as on a telephone keypad

Description

phonenumber: Convert letters to numbers and back as on a telephone keypad

phonenumber functions


Convert letters to numbers as on a telephone's keypad

Description

Take a character vector and convert it to the equivalent number sequence from a telephone's key pad

Usage

letterToNumber(value, qz = 1)

Arguments

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)

Value

A character vector of numbers and dashes based on value

Examples

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

Convert numbers to letters as on a telephone's keypad

Description

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

Usage

numberToLetter(value, decreasing = FALSE, qz = 1)

Arguments

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)

Value

A character vector of letters and dashes based on value

Examples

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

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.