is.number {lazy.tools} | R Documentation |
Check if a string vector contains numbers only.
is.number(arg, pat = 1)
arg |
a vector or a list |
pat |
= 1 to match non-negative integers |
The leading and trailing blank characters will be ignored.
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.
vec=c("a","1","1.4","b.","-b","-2","2-"," 12 ","5 5","0.4",".4","-0.","-0.8")
is.number(vec)
printm(vec,is.number(as.list(vec)),is.number(as.list(vec), 2))
is.number( list( c("1","2","a"), c(1,2) ) )
is.number( list( 2, -2,"-2","-2." ), 3 )