Does the input contain specific dimensions?

isOfDimension(x, n, .xname = getNameInParent(x))

Arguments

x

Object.

n

integer(1). Number to include.

.xname

Name of object defined in x. Not intended to be used directly.

Value

TRUE on success; FALSE on failure, with cause set.

Note

Updated 2019-10-04.

See also

Examples

x <- data.frame(a = c(TRUE, FALSE), b = c(FALSE, TRUE)) dim(x)
#> [1] 2 2
## TRUE ==== isOfDimension(x, n = c(2L, 2L))
#> [1] TRUE
## FALSE ==== isOfDimension(x, n = c(1L, 2L))
#> [1] FALSE #> Cause: Dimension 1 of 'x' is incorrect.
isOfDimension(x, n = c(2L, 1L))
#> [1] FALSE #> Cause: Dimension 2 of 'x' is incorrect.