chunk: Chunk a vector into a list of vectors of roughly equal...

Usage Arguments Details Value

Usage

1
2
3
4
5
chunk(x, n_chunks = NULL, max_chunk_size = NULL, method = c("seq", "mod",
  "rand"))

chunk_int(n, n_chunks = NULL, max_chunk_size = NULL, method = c("seq",
  "mod", "rand"))

Arguments

x

The vector or list to be chunked.

n_chunks

The number of chunks desired.

max_chunk_size

The maximum desired length of any chunk.

method

The algorithm to use for chunking. "seq" _seq_uentially chunks x. "mod" creates chunks where original indices are alike after modulo arithmetic. "rand" specifies that x should be uniformly and randomly distributed across chunks.

n

The number of integers to chunk (i.e. chunk the sequence 1:n).

Details

Exactly one of n_chunks and max_chunk_size should be NULL (to specify both as non-NULL is an error).

Value

For chunk, a list with x chunked across the list entries. For chunk_int, a list with the values 1:n chunked across the list entries.


mmuurr/zzz documentation built on May 14, 2019, 12:46 p.m.

Related to chunk in mmuurr/zzz...