Hello, Maybe ?gregexpr and ?regmatches. SOmething like the following.
m1 <- gregexpr("[a-z]+","absdfds0213451ab") regmatches("absdfds0213451ab", m1) m2 <- gregexpr("[0-9]+","absdfds0213451ab") regmatches("absdfds0213451ab", m2) Hope this helps, Rui Barradas Em 30-07-2014 21:13, carol white escreveu:
Hi, If I have a string of consecutive chars followed by consecutive numbers and then chars, like "absdfds0213451ab", how to separate the consecutive chars from consecutive numbers? grep doesn't seem to be helpful grep("[a-z]","absdfds0213451ab", ignore.case=T) [1] 1 grep("[0-9]","absdfds0213451ab", ignore.case=T) [1] 1 Thanks Carol [[alternative HTML version deleted]] ______________________________________________ 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.
______________________________________________ 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.