checkNames {checkmate} | R Documentation |
Similar to checkNamed
but you can pass the names directly.
checkNames(x, type = "named", permutation.of = NULL, subset.of = NULL, identical.to = NULL) check_names(x, type = "named", permutation.of = NULL, subset.of = NULL, identical.to = NULL) assertNames(x, type = "named", permutation.of = NULL, subset.of = NULL, identical.to = NULL, .var.name = vname(x), add = NULL) assert_names(x, type = "named", permutation.of = NULL, subset.of = NULL, identical.to = NULL, .var.name = vname(x), add = NULL) testNames(x, type = "named", permutation.of = NULL, subset.of = NULL, identical.to = NULL) test_names(x, type = "named", permutation.of = NULL, subset.of = NULL, identical.to = NULL) expect_names(x, type = "named", permutation.of = NULL, subset.of = NULL, identical.to = NULL, info = NULL, label = vname(x))
x |
[ |
type |
[character(1)] |
permutation.of |
[ |
subset.of |
[ |
identical.to |
[ |
.var.name |
[ |
add |
[ |
info |
[character(1)] |
label |
[ |
Depending on the function prefix:
If the check is successful, the functions
assertNamed
/assert_named
return
x
invisibly, whereas
checkNamed
/check_named
and
testNamed
/test_named
return
TRUE
.
If the check is not successful,
assertNamed
/assert_named
throws an error message,
testNamed
/test_named
returns FALSE
,
and checkNamed
returns a string with the error message.
The function expect_named
always returns an
expectation
.
Other attributes: checkClass
,
checkNamed
x = 1:3 testNames(x, "unnamed") names(x) = letters[1:3] testNames(x, "unique") cn = c("Species", "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width") assertNames(names(iris), permutation.of = cn)