simplifyList: Transforms a list into a more compact format

Description Usage Arguments Value Note Author(s) Examples

Description

Transforms a list of scalars, vectors, or matrices into a simplified structure with one additional dimension (i.e. a vector, matrix, or 3D array).

Usage

1

Arguments

L

List to be transformed. All elements of L must share the same type, length, dimension(s) and name(s). See the return value for supported element types.

Value

The returned type depends on the type of the elements of L.

Note

An error is generated if the restrictions with respect to the elements of L are not met.

Author(s)

David Kneis david.kneis@tu-dresden.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# List of scalars
x= list(a=1, b=2, c=3)
print(simplifyList(x))  # same as unlist(x)
# List of vectors
x= list(a=1:2, b=2:3, c=3:4)
print(simplifyList(x))
# List of matrices
m= matrix(1:6, ncol=2)
colnames(m)= paste0("col",1:ncol(m))
rownames(m)= paste0("row",1:nrow(m))
x= list(a=m*1, b=m*2, c=m*3)
print(simplifyList(x))

dkneis/diatools documentation built on May 15, 2019, 9:12 a.m.