checkNamed but you can pass the names directly.checkNames(x, type = "named")assertNames(x, type = "named", .var.name = vname(x), add = NULL)
assert_names(x, type = "named", .var.name = vname(x), add = NULL)
testNames(x, type = "named")
test_names(x, type = "named")
expect_names(x, type = "named", info = NULL, label = vname(x))
character || NULL]
Names to check using rules defined via type.x to be NULL.
x for regular names which excludes names to be NA or empty (""character(1)]
Name of the checked object to print in assertions. Defaults to
the heuristic implemented in vname.AssertCollection]
Collection to store assertion messages. See AssertCollection.expect_that.character(1)]
Name of the checked object to print in messages. Defaults to
the heuristic implemented in vname.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.x = 1:3
testNames(x, "unnamed")
names(x) = letters[1:3]
testNames(x, "unique")Run the code above in your browser using DataLab