`rray_dim_n()`

computes the dimensionality (i.e. the number of dimensions).

rray_dim_n(x)

x | An object. |
---|

An integer vector containing the number of dimensions of `x`

.

One point worth mentioning is that `rray_dim_n()`

is very strict. It does
not simply call the generic function `dim()`

and then check the length.
Rather, it explicitly pulls the attribute for the `"dim"`

, and checks
the length of that. If an object does not have an attribute, then the
dimensionality is 1.

This means that data frames have a dimensionality of 1, even though
`dim()`

defines a method for data frames that would imply a dimensionality
of 2.

#> [1] 2# NULL has a dimensionality of 1 rray_dim_n(NULL)#> [1] 1#> [1] 1