ez.is.numeric.like: Check numeric

View source: R/basic.R

ez.is.numeric.likeR Documentation

Check numeric

Description

check if a str obj is actually numeric

Usage

ez.is.numeric.like(
  x,
  naAsTrue = TRUE,
  na.strings = c("", ".", "NA", "na", "N/A", "n/a", "NaN", "nan")
)

Arguments

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.

Value

a logical vector (vectorized).

Note

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


jerryzhujian9/zmisc documentation built on March 9, 2024, 12:49 a.m.