Skip to contents

A partition is a Partition object or a non-empty integer-ish vector with no missing values.

Usage

checkPartition(x, n = length(x))

assertPartition(x, n = length(x), .var.name = checkmate::vname(x), add = NULL)

testPartition(x, n = length(x))

Arguments

x

Argument to be tested

n

the expected length of the partition.

.var.name

Name of the checked object to print in assertions. Defaults to the heuristic implemented in checkmate::vname().

add

Collection to store assertion messages. See checkmate::AssertCollection.

Value

Please see checkmate::checkMatrix() help page (for instance) for further details about the difference between check_, test_ and assert_ functions results.

Details

Extension of the checkmate package.

Examples

checkPartition(c(1, 2, 3, 1))
#> [1] TRUE
checkPartition(matrix(1L:4L, nrow = 2L))
#> [1] "argument must be a Partition object or a vector"