Learn R Programming

DescTools (version 0.99.43)

SplitAt: Split a Vector Into Several Pieces at Given Positions

Description

Split a vector into several pieces at given positions.

Usage

SplitAt(x, pos)

Arguments

x

the vector to be splitted.

pos

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

Value

a list with the splitted parts of x.

References

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

See Also

split, strsplit

Examples

Run this code
# NOT RUN {
x <- 1:10
SplitAt(x, pos=c(3, 8))
# }

Run the code above in your browser using DataLab