List of Matrices to 3D Array
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
.
lm2a(lm, dim.order = c(1, 2, 3), dimlab.list = NULL, check = TRUE)
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 |
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)
.
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")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.