Skip to contents

Split a vector into the chunks

Usage

tochunks(x, nchunks)

Arguments

x

A vector.

nchunks

Number of chunks.

Examples

x <- 1:10
names(x) <- letters[1:10]
tochunks(x, nchunks = 3)
#> $`1`
#> a b c d 
#> 1 2 3 4 
#> 
#> $`2`
#> e f g 
#> 5 6 7 
#> 
#> $`3`
#>  h  i  j 
#>  8  9 10 
#>