ez.is.numeric.like | R Documentation |
check if a str obj is actually numeric
ez.is.numeric.like(
x,
naAsTrue = TRUE,
na.strings = c("", ".", "NA", "na", "N/A", "n/a", "NaN", "nan")
)
x |
a str vector, or a factor of str vector, or numeric vector. x will be coerced and trimws. |
naAsTrue |
whether NA (including actual NA and na.strings) will be treated as numeric like |
na.strings |
case sensitive strings that will be treated to NA. |
a logical vector (vectorized).
Using regular expression
TRUE for any actual numeric c(3,4,5,9.9) or c("-3","+4.4", "-42","4L","9L", "1.36e4","1.36E4", NA, "NA", "","NaN", NaN):
positive or negative numbers with no more than one decimal c("-3","+4.4") OR
positive or negative integers (e.g., c("-42","4L","39L")) OR
positive or negative numbers in scientific notation c("1.36e4","1.36e-4","1.36e+4","1.36E4")
NA, or na.strings
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.