rearrangeList: Rearrange two-level list

Description Usage Arguments Details Value

View source: R/array_transform.R

Description

rearrangeList reshapes a special type of one- or two-level lists.

Usage

1
rearrangeList(dat, name_listdim, name_datadim = NULL)

Arguments

dat

the list to be rearranged

name_listdim

character string; the name of the dimension which the list represents

name_datadim

character vector or a list of character vectors (for two-level list input), providing the name of the dimensions for each list element. The default is NULL, meaning that the original dimension names will be used.

Details

One or two level lists which contain identically shaped elements at the base level, and elements at the base level are vectors, matrices or arrays, can be rearranged to a matrix/array (from a one-level list) or to a one-level list (from a two-level list) by binding identical elements. This way the second level of the list will be represented as an additional dimension in the ground level elements (vectors will be matrices, matrices will become arrays, arrays recieve an extra dimension)

Value

A matrix or array, if the input is a one-level list, and a one-level list, if the input is a two-level list


tdeenes/eegR documentation built on April 19, 2021, 4:17 p.m.