View source: R/11.1-basic-validators.R
| check_numeric_value | R Documentation |
Fast validation of numeric values with basic range checking. Simplified utility function for common validation needs.
check_numeric_value(value, name, min_val = -Inf, max_val = Inf)
value |
Value to validate |
name |
Parameter name for error messages |
min_val |
Minimum allowed value (default -Inf) |
max_val |
Maximum allowed value (default Inf) |
Performs essential validations:
Not NULL
Numeric type
Finite values (no NA, NaN, Inf)
Within specified range
The original value (numeric, same length as input),
returned unchanged when all checks pass. Throws an error if value
is NULL, non-numeric, contains non-finite elements (NA,
NaN, Inf), or falls outside [min_val, max_val].
check_numeric_value(5, "weight")
try(check_numeric_value(-1, "weight", min_val = 0))
try(check_numeric_value(NA, "weight"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.