| check_type_number | R Documentation |
These functions check that an argument is a number, optionally with bounds, and produce friendly error messages otherwise.
check_number_decimal(
x,
...,
min = NULL,
max = NULL,
allow_infinite = TRUE,
allow_na = FALSE,
allow_null = FALSE,
arg = caller_arg(x),
call = caller_env()
)
check_number_whole(
x,
...,
min = NULL,
max = NULL,
allow_infinite = FALSE,
allow_na = FALSE,
allow_null = FALSE,
arg = caller_arg(x),
call = caller_env()
)
x |
The argument to check. |
... |
Additional arguments passed to |
min |
Minimum value (inclusive). If |
max |
Maximum value (inclusive). If |
allow_infinite |
Whether infinite values are allowed. |
allow_na |
Whether |
allow_null |
Whether |
arg |
An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem. |
call |
The execution environment of a currently
running function, e.g. |
NULL invisibly if the check passes, throws an error otherwise.
Other input checkers:
check_data_frame(),
check_type_scalar,
stop_input_type()
check_number_decimal(3.14)
try(check_number_decimal("x"))
check_number_whole(42)
try(check_number_whole(3.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.