chunk2: Split a vector into n chunks

Description Usage Arguments Author(s) References Examples

View source: R/chunk2.R

Description

Split a vector into n chunks

Usage

1
chunk2(x, n)

Arguments

x

a vector

n

number of chunks

Author(s)

mathheadinclouds, Dis Shishkov

References

http://stackoverflow.com/questions/3318333/split-a-vector-into-chunks-in-r

Examples

1
 chunk2(1:30, 6)

Example output

$`1`
[1] 1 2 3 4 5

$`2`
[1]  6  7  8  9 10

$`3`
[1] 11 12 13 14 15

$`4`
[1] 16 17 18 19 20

$`5`
[1] 21 22 23 24 25

$`6`
[1] 26 27 28 29 30

stackoverflow documentation built on Jan. 10, 2020, 9:07 a.m.