Assert x
is one of the values of y
.
Usage
assert_one_of(x, y, msg = NULL, call = rlang::caller_env(), arg_name = NULL)
Arguments
- x
A scalar value to check
- y
A vector of acceptable values that
x
can take- msg
The error message thrown if the assertion fails (string)
- call
Only relevant when pooling assertions into multi-assertion helper functions. See cli_abort for details.
- arg_name
Advanced use only. Name of the argument passed (default: NULL, will automatically extract arg_name).
Value
Returns invisible(TRUE) if x
is a scalar and is one of the values in y
, otherwise throws an error