On Wed, Aug 4, 2010 at 7:04 AM, Megh Dal <megh700...@yahoo.com> wrote: > Hi, I want to split a text to seperate numerical and non-numerical portions > of that. For example suppose I have a text "abc 3456" and I want to split in > 2 parts like "abc" & "3456". > > Is there any function to do that? >
If the parts of your data are separated by a space then you could use strsplit or read.table > x <- "abc 3456" > > strsplit(x, " ")[[1]] [1] "abc" "3456" > > read.table(textConnection(x)) V1 V2 1 abc 3456 If there is no separator try strapply in gsubfn: > y <- "abc3456" > library(gsubfn) > strapply(y, "[^0-9]*|[0-9]*", c)[[1]] [1] "abc" "3456" ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.