chunk: Chunk elements of vectors into blocks of nearly equal size.
Description
In case of shuffling and vectors that cannot be chunked
evenly, it is chosen randomly which levels / chunks will
receive 1 element less. If you do not shuffle, always the
last chunks will receive 1 element less.
Usage
chunk(x, chunk.size, n.chunks, shuffle = FALSE)
Arguments
x
[vector | list]
Vector or list
to chunk.
chunk.size
[integer(1)]
Requested number
of elements in each chunk. Cannot be used in combination
with n.chunks. If x cannot be evenly
chunked, some chunks will have 1 element less.
n.chunks
[integer(1)]
Requested number
of chunks. Can not be used in combination with
chunks.size