checkNamed
but you can pass the names directly.checkNames(x, type = "named")assertNames(x, type = "named", add = NULL, .var.name = NULL)
assert_names(x, type = "named", add = NULL, .var.name = NULL)
testNames(x, type = "named")
test_names(x, type = "named")
expect_names(x, type = "named", info = NULL, label = NULL)
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 (""
AssertCollection
]
Collection to store assertions. See AssertCollection
.NULL
|| character(1)
]
Name of the checked object to print in error message. If NULL
,
the name will be heuristically determined via substitute
.expect_that
..var.name
, but passed down to expect_that
.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