Learn R Programming

rray (version 0.1.0)

rray_elems: Compute the number of elements in an array

Description

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.

Usage

rray_elems(x)

Arguments

x

A vector, matrix, array or rray.

Value

A single integer. The number of elements in x.

Examples

Run this code
# NOT RUN {
rray_elems(1:5)

rray_elems(matrix(1, 2, 2))

# It is different from `vec_size()`,
# which only returns the number of
# observations
library(vctrs)
vec_size(matrix(1, 2, 2))

# }

Run the code above in your browser using DataLab