lm2a {str2str} | R Documentation |
List of Matrices to 3D Array
Description
lm2a
converts a list of matrices to a 3D array where the list dimension
becomes the third dimension of the array (layers). lm2a
is a simple
wrapper function for abind::abind
.
Usage
lm2a(lm, dim.order = c(1, 2, 3), dimlab.list = NULL, check = TRUE)
Arguments
lm |
list of matrices which each have the same dimensions. |
dim.order |
integer vector of length 3 specifying the order of dimensions for
the returned array. The default is |
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 |
Value
3D array where the list elements of lm
is now a dimension. The
order of the dimensions is determined by the argument dim.order
with dimnames
specified by names(lm
). The dimnames of the returned array is determined
by the dimnames in lm[[1]]
and names(lm)
.
Examples
lm <- asplit(HairEyeColor, MARGIN = 3L)
lm2a(lm) # default
lm2a(lm, dimlab.list = "Sex")
lm2a(lm, dim.order = c(3,1,2))
lm2a(lm, dim.order = c(3,1,2), dimlab.list = "Sex")