splitIntoChunks: Split vector into chunks

View source: R/math.R

splitIntoChunksR Documentation

Split vector into chunks

Description

Internal soundgen function.

Usage

splitIntoChunks(x, n)

Arguments

x

numeric vector to split

n

number of chunks

Details

Takes a numeric vector x and splits it into n chunks. This is the fastest splitting algorithm from https://stackoverflow.com/questions/3318333/split-a-vector-into-chunks

Value

Returns a list of length n containing the chunks

Examples

# prepare chunks of iterator to run in parallel on several cores
chunks = soundgen:::splitIntoChunks(1:21, 4)
chunks

soundgen documentation built on Sept. 12, 2024, 6:29 a.m.