Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nlay

Number of Layers (the Third Dimension)


Description

nlay returns the number of layers - the third dimension - of an array. If the object does not have a third dimension (e.g., matrix), then the function will return NA with typeof = integer. If the object does not have any dimensions (e.g., atomic vector), then the function will return NULL.

Usage

nlay(x)

Arguments

x

array.

Details

R does not have standard terminology for the third dimension. There are several common terms people use including "height" and "page". I personally prefer "layer" as it makes sense whether the user visualizes the third dimension as going into/ontop a desk or into/ontop a wall.

Value

The number of layers (the third dimension) of x. The structure is an integer vector with length = 1. See details for special cases.

Examples

nlay(HairEyeColor)
a <- array(data = NA, dim = c(6,7,8,9))
nlay(a)

str2str

Convert R Objects from One Structure to Another

v0.1.1
GPL (>= 2)
Authors
David Disabato [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.