library("broadcast")
# matrix example ====
<- list(
x array(1:10, 10),
array(1:10, c(2, 5)),
array(c(letters, NA), c(3,3,3))
)lst.ndim(x)
## [1] 1 2 3
ndim
Get number of dimensions
Description
ndim()
returns the number of dimensions of an object.
lst.ndim()
returns the number of dimensions of every list-element.
Usage
ndim(x)
lst.ndim(x)
Arguments
x
|
a vector or array (for ndim() ), or a list of vectors/arrays (for lst.ndim() ). |
Value
For ndim()
: an integer scalar.
For lst.ndim()
: an integer vector, with the same length, names and dimensions as x
.