| checkNames {checkmate} | R Documentation |
Similar to checkNamed but you can pass the names directly.
checkNames(x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL) check_names(x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL) assertNames(x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, .var.name = vname(x), add = NULL) assert_names(x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, .var.name = vname(x), add = NULL) testNames(x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL) test_names(x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL) expect_names(x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, info = NULL, label = vname(x))
x |
[ |
type |
[character(1)]
Note that for zero-length |
subset.of |
[ |
must.include |
[ |
permutation.of |
[ |
identical.to |
[ |
disjunct.from |
[ |
.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,
checkMultiClass, 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)