numeric.string {cwhstring}R Documentation

Test string for being a number or made up of digits only.

Description

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

Usage

numeric.string(str)
all.digits(str)

Arguments

str A character vector.

Value

TRUE, FALSE

Author(s)

Christian W. Hoffmann, christian.hoffmann@wsl.ch, http://www.wsl.ch/staff/christian.hoffmann

Examples

all.digits(c("1231","89a8742")) #  TRUE FALSE
numeric.string(c("1231","8.9e-2",".7d2"))
 # [1]  TRUE  TRUE FALSE

[Package cwhstring version 1.0.0 Index]