`vec_dim_n()`

gives the dimensionality (i.e. number of dimensions)`vec_dim()`

returns the size of each dimension

vec_dim(x) vec_dim_n(x)

x | A vector |
---|

Unlike base R, we treat vectors with `NULL`

dimensions as 1d. This
simplifies the type system by eliding a special case. Compared to base R
equivalent, `vec_dim()`

returns `length()`

, not `NULL`

, when `x`

is 1d.

# Compared to base R x <- 1:5 dim(x)#> NULLvec_dim(x)#> [1] 5