n_split: Split vector in n parts of equal size (or close)

View source: R/vectors.R

n_splitR Documentation

Split vector in n parts of equal size (or close)

Description

If n is greater than the size of the vector, result will have the size of the vector with one item per element.

Usage

n_split(vec, n)

Arguments

vec

vector to split

n

integer number of parts

Value

list of size n

Examples

n_split(1:10, 2)
n_split(1:10, 3)


fcocquemas/hfty.helpers documentation built on Feb. 13, 2023, 7:25 a.m.