Try this: sapply(strsplit(i, ' '), grep, pattern='ENSP', value = T)
On Wed, Jul 8, 2009 at 10:04 AM, Praveen Surendran <praveen.surend...@ucd.ie > wrote: > Hi, > > > > Is there a way in R to get the string which matches the expression, where > the expression is a substring of the parent string. > > > > Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345" > > What I need is the string "pid:ENSP000012345" from $i using the query > "ENSP". > > > > Appreciate your comments. > > > > Praveen Surendran > > School of Medicine and Medical Sciences > > University College Dublin > > Belfiled, Dublin 4 > > Ireland. > > > > > [[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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[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.