Dear David, does the following work for you?
sVec <- c("lema, rb 2%", "rb 2%", "rb 3%", "rb 4%", "rb 3%", "rb 2%,mineuse", "rb", "rb", "rb 12", "rb", "rj 30%", "rb", "rb", "rb 25%", "rb", "rb", "rb", "rj, rb") reVec <- regexpr("[[:digit:]]+", sVec) # see ?regex for details on '[:digit:]' and '+' substr(sVec ,start = reVec, stop=reVec + attr(reVec, "match.length") - 1) # see ?substr for details Christian ______________________________________________ R-help@stat.math.ethz.ch 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.