vchunk: Chunk a vector into parts

Description Usage Arguments Value Author(s) Examples

Description

Chunk a vector into parts given the number of chunks or the max size of a chunk

Usage

1
2
vchunk(x, n = NULL, max.size = NULL, balance.size = TRUE,
  balance.order = FALSE)

Arguments

x

vector to chunk

n

numeric, the number of chunks

max.size

numeric, the maximal size of a chunk

balance.size

logical, as equal as possible. Whether return balanced chunks.

balance.order

logical, whether to balance the elements. Force balance.size to be TRUE. given their original orders.

Value

list

Author(s)

Xiaobei Zhao

Examples

1
2
3
4
5
6
vchunk(1:7,7)
vchunk(1:19,n=3)
vchunk(1:19,max.size=9) # size-balanced
vchunk(1:19,max.size=9,balance.size=FALSE) # size/order-unbalanced
vchunk(1:19,max.size=9,balance.size=FALSE,balance.order=TRUE) # order-balanced
vchunk(1:19,max.size=9,balance.order=TRUE) # size/order-balanced

Xmisc documentation built on May 2, 2019, 8:23 a.m.