powered by

Split a vector into several pieces at given positions.

SplitAt(x, pos)

a list with the splitted parts of x.

the vector to be splitted.

integer vector, giving the positions at which the vector should be splitted.

flodel (on StackOverflow)

https://stackoverflow.com/questions/16357962/r-split-numeric-vector-at-position

split, strsplit

split

strsplit

x <- 1:10 SplitAt(x, pos=c(3, 8))

Run the code above in your browser using DataLab