Description Usage Arguments Details Value Note
View source: R/array_general.R
chunkify
creates subsets of an array according to various chunking
schemes and performs the given function on these data chunks. The resulting
array is identical to the result of a function call on the whole array.
1 |
dat |
matrix or array with named dimnames |
fun |
name of the function (can be a character string). See Details. |
arg_list |
a list of parameters passed to |
chunks |
a named list which defines the chunking scheme. See Details. |
The main purpose of chunkify
is twofold: 1) it can decrease
memory load if a memory-intensive function is called on a large array; 2) it
enables within-dimension computations (e.g. perform baseline correction
separately for various levels of the trial dimension). The parameter
chunks
is a named list; each element must correspond to a named
dimension of dat
. If the list element contains one integer, it gives
the number of chunks for the given dimension. If it contains as many elements
as the length of the given dimension, it defines chunk code; i.e.,
which chunk the given level of the dimension belongs to. Otherwise, the
list elements are expanded (recycled to the dimensions' length) and
interpreted as chunk codes. fun
must be a function which operates on
arrays (or matrices), and returns a matrix or array with named dimensions.
Chunking can be based only on those dimensions which are not affected by
fun
.
An array (or vector/matrix); its shape and dimension names are
identical to the return value of fun
called on dat
without
chunking
This function is experimental.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.