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

a2lm

(3D) Array to List of Matrices


Description

a2lm converts a (3D) array to a list of matrices. This is a simple call to asplit with a default to convert the third dimension to a list dimension.

Usage

a2lm(a, along = 3L, check = TRUE)

Arguments

a

3D array.

along

integer vector of length 1 specifying the dimension to slice the array along. This dimension is converted to the list dimension. 1 = rows; 2 = columns; 3 = layers.

check

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

Value

list of matrices - all with the same dimensions.

Examples

a2lm(HairEyeColor)
a2lm(HairEyeColor, along = 1)
try_expr(a2lm(mtcars)) # error b/c  not a 3D array

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.