Generate a Sequence of Integers, and Split into Chunks

Share:

Description

This function takes a set of endpoints, and 'chunks' the sequence from min to max into a list with each element of size size.

Usage

1
chunk(min, max, size, by = 1)

Arguments

min

The lower end (start point) of the sequence.

max

The upper end (end point) of the sequence.

size

The number of elements to place in each chunk.

by

The difference between consecutive elements.

Details

If max is not specified, then we generate a chunk of integers from 1 to min, each of size size. This allows you to specify chunks with syntax like chunk(100, size=5).

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.