Description Usage Arguments Value
This function chops a vector into a given number of pieces, and it
tries to do this by making them as similar in length as possible.
This function is used when splitting an array into chunks in order
for foreach
to work upon them in parallel, and it is also
used in splitting
that aims to avoid out-of-memory errors
(due to large intermediate objects) by creating sizeable chunks
that stays below a memory-limit. It does also allow additional stuff
to be stored in the result, see details below.
1 2 3 | split_vector(vec, pieces, allow_extra_pieces = FALSE,
compute_name = NULL, subset_name = NULL, add_to_compute = NULL,
position = 1)
|
vec |
The vector we want to split. |
pieces |
The number of chunks we want in the end. |
allow_extra_pieces |
Logical argument, default value
|
compute_name |
Use this to specify the name to be used in the
compute-part of the resulting list. When the default
|
subset_name |
Use this to specify the name to be used in the
subset-part of the resulting list. When the default
|
add_to_compute |
|
position |
An integer, default value 1, that only should be
used when |
This function returns a list with three components:
pieces
, a vector that we want to loop over, and,
subset
and compute
that respectively gives the
arguments needed by the function 'restrict' (that also can do
replacements) and the function that performs the computation of
interest.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.