Does the input have dimensions?
See also
dim()orBiocGenerics::dims()forDFrameList.nrow()orBiocGenerics::nrows()forDFrameList.ncol()orBiocGenerics::ncols()forDFrameList.assertive.properties::has_dims().assertive.properties::has_rows().assertive.properties::has_cols().
Examples
## TRUE ====
x <- datasets::mtcars
hasDims(x)
#> [1] TRUE
hasRows(x)
#> [1] TRUE
hasCols(x)
#> [1] TRUE
## Note that dims don't have to be non-zero, just not NULL.
hasDims(data.frame())
#> [1] TRUE
## Expected dimension number is supported.
x <- matrix(data = seq(from = 1L, to = 6L), nrow = 3L, ncol = 2L)
## For `hasDims`, `n` corresponds to rows, columns.
hasDims(x, n = c(3L, 2L))
#> [1] TRUE
hasRows(x, n = 3L)
#> [1] TRUE
hasCols(x, n = 2L)
#> [1] TRUE
## FALSE ====
x <- data.frame()
hasDims(list())
#> [1] FALSE
hasRows(x)
#> [1] FALSE
hasCols(x)
#> [1] FALSE