| check_type_scalar | R Documentation |
These functions check that an argument is of the expected scalar type and produce friendly error messages otherwise.
check_bool(
x,
...,
allow_na = FALSE,
allow_null = FALSE,
arg = caller_arg(x),
call = caller_env()
)
check_string(
x,
...,
allow_empty = TRUE,
allow_na = FALSE,
allow_null = FALSE,
arg = caller_arg(x),
call = caller_env()
)
x |
The argument to check. |
... |
Additional arguments passed to |
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. |
allow_empty |
Whether the empty string |
NULL invisibly if the check passes, throws an error otherwise.
Other input checkers:
check_data_frame(),
check_type_number,
stop_input_type()
check_bool(TRUE)
try(check_bool(1))
check_string("hello")
try(check_string(42))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.