chunk: Generate a number of index ranges from a vector

Description Usage Arguments Details

View source: R/chunk.R

Description

The ranges have a maximum length.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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.


djvanderlaan/lvec documentation built on Oct. 31, 2017, 8:39 a.m.