Assert that an object is within a certain oprtions.
Usage
assertChoice(
x,
choices,
length = NULL,
na = FALSE,
null = FALSE,
empty = TRUE,
unique = FALSE,
named = FALSE,
nm = deparse1(substitute(x), backtick = TRUE),
call = parent.frame(),
msg = NULL
)Arguments
- x
Variable to check.
- choices
Options that x is allowed to be.
- length
Required length. If
NULLlength is not checked.- na
Whether it can contain NA values.
- null
Whether it can be NULL.
- empty
Whether it can be empty.
- unique
Whether it has to contain unique elements.
- named
Whether it has to be named.
- nm
Name to use in error messages. Defaults to the expression supplied to
x.- call
Call argument that will be passed to
clierror message.- msg
Custom error message.