d: Length of object dimensions

View source: R/shortcuts.R

dR Documentation

Length of object dimensions

Description

A common function to compute the number of elements (in vectors and lists) or the number of vectors in each dimension (dataframes, matrices, and arrays) of common types of R objects.

Usage

d(x)

Arguments

x

An input object whose dimensions will be computed.

Value

Returns a length-n integer vector where n is the number of dimensions in x (e.g. n=1 for atomic vectors and lists, n=2 for matrices and dataframes, and n may be more than 2 for some arrays). Each element in the output is the number of elements in that dimension of x (e.g. if n=1, the number of elements in the list or vector, if n=2, first the number of rows in the dataframe or matrix, then the number of columns).


ballardao/abmisc documentation built on March 28, 2022, 6:40 a.m.