numeric.string {cwhstring} | R Documentation |
numeric.string
Test whether the elements of a character vector
represent legal numbers only.
all.digits
Test whether the elements of a character vector consist of digits only
numeric.string(str) all.digits(str)
str |
A character vector. |
TRUE, FALSE
Christian W. Hoffmann, christian.hoffmann@wsl.ch, http://www.wsl.ch/staff/christian.hoffmann
all.digits(c("1231","89a8742")) # TRUE FALSE numeric.string(c("1231","8.9e-2",".7d2")) # [1] TRUE TRUE FALSE