
Last chance! 50% off unlimited learning
Sale ends in
Tests, 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.
all.is.numeric(x, what = c("test", "vector"), extras=c('.','NA'))
a character vector
specify what="vector"
to return a numeric vector if
it passes the test, or the original character vector otherwise
a vector of character strings to count as numeric
values, other than ""
.
a logical value if what="test"
or a vector otherwise
# NOT RUN {
all.is.numeric(c('1','1.2','3'))
all.is.numeric(c('1','1.2','3a'))
all.is.numeric(c('1','1.2','3'),'vector')
all.is.numeric(c('1','1.2','3a'),'vector')
all.is.numeric(c('1','',' .'),'vector')
# }
Run the code above in your browser using DataLab