Re: [R] Quick GREP challenge

2010-08-26 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri Shvorob > Sent: Thursday, August 26, 2010 3:16 AM > To: r-help@r-project.org > Subje

Re: [R] Quick GREP challenge

2010-08-26 Thread Dimitri Shvorob
Many thanks! -- View this message in context: http://r.789695.n4.nabble.com/Quick-GREP-challenge-tp2339486p2339818.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

Re: [R] Quick GREP challenge

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 8:15 AM, Gabor Grothendieck wrote: On Thu, Aug 26, 2010 at 6:16 AM, Dimitri Shvorob wrote: grep("f[0-9]+=", "f1=5,f22=3,", value = T) [1] "f1=5,f22=3," How do I make the line output c("f1", "f22") instead? (Actually, c(1,22) would be even better). strapply in gsu

Re: [R] Quick GREP challenge

2010-08-26 Thread Gabor Grothendieck
On Thu, Aug 26, 2010 at 6:16 AM, Dimitri Shvorob wrote: > >> grep("f[0-9]+=", "f1=5,f22=3,", value = T) > [1] "f1=5,f22=3," > > How do I make the line output c("f1", "f22") instead? (Actually, c(1,22) > would be even better). > strapply in gsubfn extracts matches based on content rather than deli

Re: [R] Quick GREP challenge

2010-08-26 Thread Duncan Mackay
I too am unsure of what is required but another way is gsub(",$","",gsub("[f53=]+","",a)) [1] "1,22" Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email home: mac...@northnet.com.au At 21:47 26/08/2010, you wrote: It isn't

Re: [R] Quick GREP challenge

2010-08-26 Thread Sarah Goslee
It isn't entirely clear what you are trying to do - your grep() statement simply returns the entire string you started with. But to turn that string into a vector, you will need some combination of gsub(), strsplit(), and as.numeric() with the exact values depending on the exact form of the output

[R] Quick GREP challenge

2010-08-26 Thread Dimitri Shvorob
> grep("f[0-9]+=", "f1=5,f22=3,", value = T) [1] "f1=5,f22=3," How do I make the line output c("f1", "f22") instead? (Actually, c(1,22) would be even better). Thank you. -- View this message in context: http://r.789695.n4.nabble.com/Quick-GREP-challenge-tp2339486p2339486.html Sent from the