vpartition: Vector partitioning

View source: R/acopula.r

vpartitionR Documentation

Vector partitioning

Description

Split a vector to subvectors of specified lengths.

Usage

vpartition(x, lengths, matrixify = TRUE)

Arguments

x

vector to be splitted.

lengths

numeric vector. Lengths of the subvectors.

matrixify

logical. Whether to return matrix if lengths are identical.

Details

If sum(lengths)>length(x) holds true, the extra places are filled with NAs.

Value

List of numeric vectors, or a matrix if all lengths are equal.

Author(s)

Tomas Bacigal

Examples

vpartition(1:10,c(4,5,2))

acopula documentation built on Sept. 11, 2023, 1:08 a.m.