StrSpell: Spell a String Using the NATO Phonetic or the Morse Alphabet

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/DescTools.r

Description

The function splits a string into single characters and returns their representation in either the NATO phonetic alphabet or the Morse alphabet. The 26 code words in the NATO phonetic alphabet are assigned to the 26 letters of the English alphabet in alphabetical order as follows: Alfa, Bravo, Charlie, Delta, Echo, Foxtrot, Golf, Hotel, India, Juliett, Kilo, Lima, Mike, November, Oscar, Papa, Quebec, Romeo, Sierra, Tango, Uniform, Victor, Whiskey, X-ray, Yankee, Zulu. Digits 0-9 are also supported.

Usage

1
StrSpell(x, upr = "CAP", type = c("NATO", "Morse"))

Arguments

x

character, the string to be encoded.

upr

character, a shortcut to be used to characterise capital letters. Ignored if type is set to "Morse". No distinction is made between upper and lower case if upr is set to NA or to an empty string "".

type

the type of phonetic alphabet, either "NATO" or "Morse".

Value

a character vector containing the code words

Author(s)

Andri Signorell <andri@signorell.net>

References

https://en.wikipedia.org/wiki/NATO_phonetic_alphabet

See Also

strsplit

Examples

1
2
3
4
# ... ever had to communicate a password by phone? ;-)
StrSpell("Yailov9teb6i")

paste(StrSpell("Andri", type="Morse"), collapse="|")

Example output

 [1] "CAP Yankee" "Alfa"       "India"      "Lima"       "Oscar"     
 [6] "Victor"     "Nine"       "Tango"      "Echo"       "Bravo"     
[11] "Six"        "India"     
[1] ".-|-.|-..|.-.|.."

DescTools documentation built on June 17, 2021, 5:12 p.m.