make_chunks: Split inputs into a number of chunks

View source: R/chunks.R

make_chunksR Documentation

Split inputs into a number of chunks

Description

Split inputs into a number of chunks

Usage

make_chunks(x, size = length(x), nchunks = NULL, chunksize = NULL)

Arguments

x

A vector of inputs e.g. ids, neurons etc (optional, see examples)

size

The number of inputs (defaults to length(x) when x is present)

nchunks

The desired number of chunks

chunksize

The desired number of items per chunk

Details

You must specify exactly one of nchunks and chunksize.

Value

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 .

Examples

make_chunks(1:11, nchunks=2)
make_chunks(size=11, chunksize=2)

jefferis/nat.utils documentation built on July 6, 2023, 4:42 p.m.