numericString {cwhmisc} | R Documentation |
Functions for testing strings and for conversion of integers to bases other than decimal as string representations.
numericString(str) allDigits(str) intToASCII(i) intToBase(i,Base=2) intToOct(i) intToHex(i)
str |
A character vector. |
i |
Integer number to be converted. |
Base |
Number base to be converted to. |
numericString
Test whether the elements of a character vector
represent legal numbers only.
allDigits
Test whether the elements of a character vector consist of digits only.
intToASCII
Show character or octal representation at a place in the ASCII sequence.
intToBase
Convert an integer number to string representation in a base between 2 and 16 inclusive.
intToOct
Convert an integer number to string representation in octal.
intToHex
Convert an integer number to string representation in hexadecimal.
TRUE, FALSE, string representations
Christian W. Hoffmann <c-w.hoffmann@sunrise.ch>
http://www.wsl.ch/personal_homepages/hoffmann/index_EN
allDigits(c("1231","89a8742")) # TRUE FALSE numericString(c("1231","8.9e-2",".7d2")) # [1] TRUE TRUE FALSE intToASCII(1:255) sapply(1:50,intToBase,2) sapply(1:50,intToBase,7) sapply(1:50,intToOct) sapply(1:50,intToHex)