Learn R Programming

DescTools (version 0.99.56)

SplitAt: Split a Vector Into Several Pieces at Given Positions

Description

Split a vector into several pieces at given positions.

Usage

SplitAt(x, pos)

Value

a list with the splitted parts of x.

Arguments

x

the vector to be splitted.

pos

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

Author

flodel (on StackOverflow)

References

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

See Also

Examples

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

Run the code above in your browser using DataLab