checkMultiClass {checkmate} | R Documentation |
Check the class membership of an argument
Description
Check the class membership of an argument
Usage
checkMultiClass(x, classes, null.ok = FALSE)
check_multi_class(x, classes, null.ok = FALSE)
assertMultiClass(x, classes, null.ok = FALSE, .var.name = vname(x), add = NULL)
assert_multi_class(
x,
classes,
null.ok = FALSE,
.var.name = vname(x),
add = NULL
)
testMultiClass(x, classes, null.ok = FALSE)
test_multi_class(x, classes, null.ok = FALSE)
expect_multi_class(x, classes, null.ok = FALSE, info = NULL, label = vname(x))
Arguments
x |
[any] |
classes |
[ |
null.ok |
[ |
.var.name |
[ |
add |
[ |
info |
[ |
label |
[ |
Value
Depending on the function prefix:
If the check is successful, the functions
assertMultiClass
/assert_multi_class
return
x
invisibly, whereas
checkMultiClass
/check_multi_class
and
testMultiClass
/test_multi_class
return
TRUE
.
If the check is not successful,
assertMultiClass
/assert_multi_class
throws an error message,
testMultiClass
/test_multi_class
returns FALSE
,
and checkMultiClass
/check_multi_class
return a string with the error message.
The function expect_multi_class
always returns an
expectation
.
See Also
Other attributes:
checkClass()
,
checkNamed()
,
checkNames()
Other classes:
checkClass()
,
checkR6()
Examples
x = 1
class(x) = "bar"
checkMultiClass(x, c("foo", "bar"))
checkMultiClass(x, c("foo", "foobar"))