Skip to contents

Validates dim(value) of a data.frame, matrix or array. NA entries in dims match any extent.

Usage

require_dim(restriction, dims)

Arguments

restriction

a restriction object.

dims

numeric vector of required extents, one per dimension; NA leaves that dimension unchecked.

Value

The modified restriction object.

Examples

design <- restrict("X") |> require_class("matrix") |> require_dim(c(NA, 3))
design(matrix(0, 10, 3))
try(design(matrix(0, 10, 2)))
#> Error : X: must have dim (any, 3)
#>   Found: dim (10, 2)