utility to check which elements of vector are numbers, even if stored as text like "01"
Source:R/utils_is.numeric.text.R
is.numeric.text.Rdutility to check which elements of vector are numbers, even if stored as text like "01"
Usage
# S3 method for class 'text'
is.numeric(x, na.is = c(NA, TRUE, FALSE)[1])Details
Checks which elements of vector contain only digits or leading/trailing spaces and have only zero or one period (decimal) and have only zero or one minus sign, which must be the first nonspace character if it is there.
Does not matter if stored as text character or numeric, so number can be stored as text like "01" or " -1.32" ".3" or "3." even "." ? even "-" ? NOT "- 2" and not "3-1" and not "2.0.6"