array_to_list_array: Convert a large array into a list of arrays.

Description Usage Arguments Value

View source: R/array_to_list_array.R

Description

The purpose of this function is to take an array with several dimension and adjust it into a list of arrays instead. (It will also work when a list of arrays are encountered). This can e.g. be use full if an interactive investigation requires some particular subsets of the original array to be visualised, since an initial conversion to list of suitable sub-arrays might speed up the extraction of relevant slices later on.

Usage

1
2
array_to_list_array(.arr, .array_nodes = NULL, .sub_dim = NULL,
  .add_dims_attribute = FALSE)

Arguments

.arr

The array to be converted into a list array. Note that this array must have dimension names, and that uniqueness of the names (at the different levels) must be satisfied. Note that .arr itself can be a list of arrays, in which case the function will be used on those nodes that are arrays (with exception of place-holder nodes having a one-dimensional array), and it will then be assumed that all the array-nodes satisfies the requirements needed for this function to work upon them.

.array_nodes

Either NULL (default value) or a vector that gives a subset of the names of the dimension-names list. These names will be used to create a skeleton-list for the sub-arrays to be stored, and it will be used to define the argument .sub_dim when that is given as NULL. If this argument is NULL and .sub_dim is different from NULL, then a value for .array_nodes will be computed based on .sub_dim. (At least one of .array_nodes or .sub_dim must be different from NULL.) NB: If the value character(0) is given (or computed), then the original array will be returned.

.sub_dim

Either NULL (default value) or a vector that gives a subset of the names of the dimension-names list. These names will be to specify the dimensions (and the order of them) to be used for the stored sub-arrays. It will also be used to define the argument .array_nodes when that is given as NULL. If this argument is NULL and .array_nodes is different from NULL, then a value for .sub_dim will be computed based on .sub_dim. (At least one of .array_nodes or .sub_dim must be different from NULL.)

.add_dims_attribute

Logical value, default FALSE, that can be used to return a list array with attributes that specifies the dimension and dimension-names found at the different nodes.

Value

An object of class list_array, constructed according to the specifications in the given arguments. Note that the dimension names of the array-nodes all are identical, and to save memory those dimension-names are not stored for each individual array but rather stored as an attribute of the main result.


LAJordanger/leanRcoding documentation built on Feb. 27, 2020, 4:42 p.m.