check-scalar-hasDims | R Documentation |
Does the input have dimensions?
hasDims(x, n = NULL)
hasRows(x, n = NULL)
hasCols(x, n = NULL)
x |
Object. |
n |
|
TRUE
on success;
FALSE
on failure, with cause set.
Updated 2023-10-06.
dim()
or BiocGenerics::dims()
for DFrameList
.
nrow()
or BiocGenerics::nrows()
for DFrameList
.
ncol()
or BiocGenerics::ncols()
for DFrameList
.
assertive.properties::has_dims()
.
assertive.properties::has_rows()
.
assertive.properties::has_cols()
.
## TRUE ====
x <- datasets::mtcars
hasDims(x)
hasRows(x)
hasCols(x)
## Note that dims don't have to be non-zero, just not NULL.
hasDims(data.frame())
## 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))
hasRows(x, n = 3L)
hasCols(x, n = 2L)
## FALSE ====
x <- data.frame()
hasDims(list())
hasRows(x)
hasCols(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.