Validates that an object is numeric and optionally satisfies additional structural constraints such as integer-valuedness or positivity.
Usage
isNumeric(
x,
isIntegerValued = FALSE,
isPositive = FALSE,
tol = sqrt(.Machine$double.eps),
na.rm = FALSE
)Arguments
- x
an object to be tested.
- isIntegerValued
logical. If
TRUE, values must be whole-like (within tolerance). UsesisWholeLike()internally.- isPositive
logical. If
TRUE, all values must be strictly greater than zero.- tol
numerical tolerance used when
isIntegerValued = TRUE. Default issqrt(.Machine$double.eps).- na.rm
logical. If
TRUE, missing values are removed before validation. IfFALSE(default) andxcontainsNA, the function returnsFALSE.
Details
The function checks:
Whether
xis numeric.Whether all values are finite.
Optional integer-like constraint via
isWholeLike().Optional positivity constraint.
This function is intended for internal validation in statistical routines.
Length validation is the responsibility of the caller and should be
performed separately with an explicit length() check.
See also
Other data.predicate:
flags(),
isDichotomous(),
isEuclid(),
isLowCardinality(),
isWholeLike(),
isZero(),
nUnique()
