isNumeral | R Documentation |
Determines whether each element of a character vector can be coerced to numeric.
isNumeral(c) is.numeral(c)
c |
A vector of strings. |
Checks element-wise as to whether each item in a vector of strings can be coerced to numeric.
Basics cribbed from http://rosettacode.org/wiki/Determine_if_a_string_is_numeric#R.
is.numeral()
is deprecated.
A vector of logicals, NA where is.na(c)
.
David Braze davebraze@gmail.com
x <- c('a', 'IX', 'twelve', '0001', '2', '3e1', '-4', '5.5', 'Inf', NA) data.frame(x, isNumeral(x), as.numeric(x))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.