powered by
This function splits a vector at specific positions.
split_vector_at(x, at)
A list.
list
[atomic()`] A vector of elements.
[integer()] Index position(s) just before to split.
integer()
For example, at = n splits before the nth element of x.
at = n
n
x
Based on https://stackoverflow.com/a/19274414.
Other vector helpers: check_numeric_vector(), check_probability_vector(), chunk_vector(), insert_vector_entry(), map_indices(), match_numerics(), permutations(), subsets(), vector_occurrence()
check_numeric_vector()
check_probability_vector()
chunk_vector()
insert_vector_entry()
map_indices()
match_numerics()
permutations()
subsets()
vector_occurrence()
x <- 1:10 split_vector_at(x, c(2, 3, 5, 7))
Run the code above in your browser using DataLab