Split inputs into a number of chunks
make_chunks(x, size = length(x), nchunks = NULL, chunksize = NULL)
The elements of x split into a list of chunks or (when x
is
missing) a vector of integer indices in the range 1:nchunks
specifying the chunk for each input element .
You must specify exactly one of nchunks
and chunksize
.
make_chunks(1:11, nchunks=2)
#> $`1`
#> [1] 1 2 3 4 5 6
#>
#> $`2`
#> [1] 7 8 9 10 11
#>
make_chunks(size=11, chunksize=2)
#> [1] 1 1 2 2 3 3 4 4 5 5 6