Splits sequence in n groups of equal size or groups of max l
Usage
split_seq(sequence, n = NULL, l = NULL, split.labels = NULL)
Arguments
- sequence
vector
- n
number of groups. Ignored if l is specified.
- l
max length of groups
- split.labels
optional label for groups
Examples
split_seq(1:8, l = 3)
#> $g1
#> [1] 1 2 3
#>
#> $g2
#> [1] 4 5
#>
#> $g3
#> [1] 6 7 8
#>