This function splits a vector at specific positions.
Arguments
- x
[atomic()`]
A vector of elements.- at
[
integer()]
Index position(s) just before to split.For example,
at = nsplits before thenth element ofx.
See also
Other vector helpers:
check_numeric_vector(),
check_probability_vector(),
chunk_vector(),
equidistant_vectors(),
insert_vector_entry(),
map_indices(),
match_numerics(),
permutations(),
subsets(),
vector_occurrence()
Examples
x <- 1:10
split_vector_at(x, c(2, 3, 5, 7))
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 2
#>
#> [[3]]
#> [1] 3 4
#>
#> [[4]]
#> [1] 5 6
#>
#> [[5]]
#> [1] 7 8 9 10
#>
