[ top | up ]
Split the Strings in a Vector
Syntax
strsplit(x,split)
Description
strsplit takes two arguments. A character vector to split, x, and a
character string, split, to use as splits (this can also be a vector).
It returns a list each element of which contains the vector of splits.
See Also
paste, nchar, substr
Examples
x<-c("asfef","qwerty","yuiop[","b","stuff.blah.yech")
#split x on the letter e
> strsplit(x,"e")
[[1]]
[1] "asf" "f"
[[2]]
[1] "qw" "rty"
[[3]]
[1] "yuiop["
[[4]]
[1] "b"
[[5]]
[1] "stuff.blah.y" "ch"