| checkMultiClass {checkmate} | R Documentation |
Check the class membership of an argument
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))
x |
[any] |
classes |
[ |
null.ok |
[ |
.var.name |
[ |
add |
[ |
info |
[character(1)] |
label |
[ |
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 returns a string with the error message.
The function expect_multi_class always returns an
expectation.
Other attributes: checkClass,
checkNamed, checkNames
Other classes: checkClass,
checkR6
x = 1
class(x) = "bar"
checkMultiClass(x, c("foo", "bar"))
checkMultiClass(x, c("foo", "foobar"))