rray_elems() computes the number of individual elements in an array. It
generally computes the same thing as length(), but has a more predictable
name.
rray_elems(x)
| x | A vector, matrix, array or rray. |
|---|
A single integer. The number of elements in x.
rray_elems(1:5)#> [1] 5#> [1] 4# It is different from `vec_size()`, # which only returns the number of # observations library(vctrs) vec_size(matrix(1, 2, 2))#> [1] 2