try this: > x <- "1234C/Tasdf" > y <- strsplit(sub("^.*(.)/(.).*", "\\1 \\2", x),' ')[[1]] > y [1] "C" "T" >
On Thu, Jun 3, 2010 at 2:18 PM, karena <dr.jz...@gmail.com> wrote: > > I have a data.frame as the following: > var1 var2 > 9G/G09 abd89C/T90 > 10A/T9 32C/C > 90G/G A/A > . . > . . > . . > 10T/C 00G/G90 > > What I want is to get the letters which are on the left and right of '/'. > for example, for "9G/G09", I only want "G", "G", and for "abd89C/T90", I > only want "C" and "T", how to get these? > > thank you, > > karena > -- > View this message in context: > http://r.789695.n4.nabble.com/string-handling-tp2242119p2242119.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.