all.is.numeric.RdTests, without issuing warnings, whether all elements of a character
vector are legal numeric values, or optionally converts the vector to a
numeric vector. Leading and trailing blanks in x are ignored.
a character vector
specify what="vector" to return a numeric vector if
it passes the test, or the original character vector otherwise, the
default "test" to return FALSE if there are no
non-missing non-extra values of x or there is at least
one non-numeric value of x, or "nonnum" to return the
vector of non-extra, non-NA, non-numeric values of x.
a vector of character strings to count as numeric
values, other than "".
a logical value if what="test" or a vector otherwise
all.is.numeric(c('1','1.2','3'))
#> [1] TRUE
all.is.numeric(c('1','1.2','3a'))
#> [1] FALSE
all.is.numeric(c('1','1.2','3'),'vector')
#> [1] 1.0 1.2 3.0
all.is.numeric(c('1','1.2','3a'),'vector')
#> [1] "1" "1.2" "3a"
all.is.numeric(c('1','',' .'),'vector')
#> [1] 1 NA NA
all.is.numeric(c('1', '1.2', '3a'), 'nonnum')
#> [1] "3a"