Check names to comply to specific rules
Performs various checks on character vectors, usually names.
checkNames( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names" ) check_names( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names" ) assertNames( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names", .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, what = "names", .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, what = "names" ) test_names( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names" ) expect_names( x, type = "named", subset.of = NULL, must.include = NULL, permutation.of = NULL, identical.to = NULL, disjunct.from = NULL, what = "names", info = NULL, label = vname(x) )
x |
[ |
type |
[character(1)]
Note that for zero-length |
subset.of |
[ |
must.include |
[ |
permutation.of |
[ |
identical.to |
[ |
disjunct.from |
[ |
what |
[ |
.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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.