is.number {lazy.tools}R Documentation

Check if a vector contains numbers only.

Description

Check if a vector contains numbers only.

Usage

is.number(arg, pat = 1)

Arguments

arg

a vector or a list

pat

= 1 to match non-negative integers
= 2 to match signed real numbers

Value

If arg is a vector or matrix, a scalar TRUE or FALSE.
If arg is a list, a vector of the same length as the arg consisting of TRUEs or FALSEs.

Examples

vec=c("a","1","1.4","b.","-b","-2","2-","122 "," 55","0.4",".4","-0.","-0.8")
is.number(vec)
vec2=c("1","0","90")
is.number( list( vec, vec2, 1:6) )


[Package lazy.tools version 0.1.3 Index]