Two vectors are of compatible size if and only if:
At least one vector has size 1
or both vectors are of the same size.
Usage
check_length(x, len)
assert_length(x, len, .var.name = checkmate::vname(x), add = NULL)
test_length(x, len)
Arguments
- x
(
any
)
the first vector, any object for whichlength()
function is defined.- len
(
count
)
the length of the second vector.- .var.name
[
character(1)
]
Name of the checked object to print in assertions. Defaults to the heuristic implemented invname
.- add
[
AssertCollection
]
Collection to store assertion messages. SeeAssertCollection
.
See also
assertions
for more details.