la2a {str2str}R Documentation

List of (3D+) Arrays to (3D+) Array

Description

la2a converts a list of (3D+) arrays to a one dimension larger (3D+) array where the list dimension becomes the additional dimension of the array. la2a is a simple wrapper function for abind::abind. If you have a list of matrices, then use lm2a.

Usage

la2a(la, dim.order = 1:(ndim(la[[1]]) + 1L), dimlab.list = NULL, check = TRUE)

Arguments

la

list of 3D+ arrays which each have the same dimensions.

dim.order

integer vector of length = ndim(la[[1]]) + 1L specifying the order of dimensions for the returned array. The default is 1:(ndim(la[[1]]) + 1L) which means the arrays within la maintain their dimensions and the list dimension is appended as the last dimension.

dimlab.list

character vector of length 1 specifying the dimlabel for the list dimension.

check

logical vector of length 1 specifying whether to check the structure of the input arguments. For example, check whether la is a list of 3D+ arrays. This argument is available to allow flexibility in whether the user values informative error messages (TRUE) vs. computational efficiency (FALSE).

Value

3D+ array where the list elements of la is now a dimension. The order of the dimensions is determined by the argument dim.order. The dimnames of the returned array is determined by the dimnames in la[[1]] and names(la).

Examples

la <- list("one" = HairEyeColor, "two" = HairEyeColor*2, "three" = HairEyeColor*3)
la2a(la) # default
la2a(la, dimlab.list = "Multiple")
la2a(la, dim.order = c(4,3,1,2))
la2a(la, dim.order = c(4,3,1,2), dimlab.list = "Multiple")

[Package str2str version 1.0.0 Index]