chunk: Generate a number of index ranges from a vector

View source: R/chunk.R

chunkR Documentation

Generate a number of index ranges from a vector

Description

The ranges have a maximum length.

Usage

chunk(x, ...)

## S3 method for class 'lvec'
chunk(x, chunk_size = 1e+06, ...)

## Default S3 method:
chunk(x, chunk_size = NULL, ...)

## S3 method for class 'data.frame'
chunk(x, chunk_size = NULL, ...)

Arguments

x

an object for which the index ranges should be calculated. Should support the length method. For example, an lvec or a regular R vector.

...

ignored; used to pass additional arguments to other methods.

chunk_size

a numeric vector of length 1 giving the maximum length of the chunks.

Details

The default chunk size can be changes by setting the option 'chunk_size', ('options(chunk_size = <new default chunk size>)').

Implementations of chunk for data frames and regular vectors are provided to make it easier to write code that works on both lvec objects and regular R objects.


lvec documentation built on Nov. 10, 2022, 6:18 p.m.

Related to chunk in lvec...