[R] seperate strings

Marc Schwartz MSchwartz at mn.rr.com
Fri May 26 05:04:26 CEST 2006


On Fri, 2006-05-26 at 11:34 +0800, XinMeng wrote:
> x<- "a;b;c;d" 
> How can I get: "a" "b" "c" "d"? 
> 
> Thanks a lot!

See ?strsplit and ?unlist

> x <- "a;b;c;d"

> strsplit(x, split = ";")
[[1]]
[1] "a" "b" "c" "d"

> unlist(strsplit(x, split = ";"))
[1] "a" "b" "c" "d"


HTH,

Marc Schwartz



More information about the R-help mailing list