Learn R Programming

str2str (version 1.0.0)

laynames: Names of the Layers (the Third Dimension)

Description

laynames returns the names of the layers - the third dimension - of an array. If the object does not have a third dimension (e.g., matrix), then the function will return NULL. If the object does not have any dimensions (e.g., atomic vector), then the function will also return NULL.

Usage

laynames(x)

Value

Names of the layers (the third dimension) of x. The structure is a character vector with length = nlay(x). See details for special cases.

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.

Examples

Run this code
laynames(HairEyeColor)
a <- array(data = NA, dim = c(6,7,8,9))
laynames(a)
laynames(c(1,2,3))

Run the code above in your browser using DataLab