DIM()
is to dim()
as NROW()
is to nrow()
. That is, it is identical to
dim()
in most cases except if the input is a bare atomic vector with no
dim
attribute, in which case, the length of the vector is returned instead
of NULL
.
DROP
first calls base::drop
and then completely removes the dim
attribute if the result is a 1-d array
DIM(x) DROP(x)
x | an R vector, potentially with a dim attribute |
---|
For DIM
, the dim
attribute, or if that's not found, then length(x)
For DROP
an array with 2 or more axes, or a vector with no dim
attributes.
#> NULL#> [1] 3DIM(x)#> [1] 3#> [1] 3#> int [1:3(1d)] 1 2 3#> int [1:3] 1 2 3