Test argument to see if it's a numeric within one more constraints.
Source:R/integrity.R
validate_number.Rd
Can identify lower and/or upper limits, either inclusive (limits_inclusive
) or exclusive
(limits_exclusive
).
Usage
validate_number(
x,
limits_inclusive = NULL,
limits_exclusive = NULL,
...,
arg = rlang::caller_arg(x),
call = rlang::caller_env()
)
Arguments
- x
item to test
- limits_inclusive
Defines inclusive constraints. If provided, numeric vector of length 2, with first value being the lower limit and second value being the upper limit. Use NA to identify a limit that should be ignored. E.g., if a value should be no less than 0 but has no upper limit, use
limits_inclusive = c(0, NA)
.- limits_exclusive
As limits_inclusive, but for exclusive limits (e.g., a value must be greater than 0).
- ...
additional arguments
- arg
For identifying argument from the calling function
- call
For identifying the calling function