[R] Quick GREP challenge
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Aug 26 14:15:25 CEST 2010
On Thu, Aug 26, 2010 at 6:16 AM, Dimitri Shvorob
<dimitri.shvorob at gmail.com> 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
delimiters. See home page for more info http://gsubfn.googlecode.com
> library(gsubfn)
> x <- "f1=5,f22=3,"
> strapply(x, "f\\d+")[[1]]
[1] "f1" "f22"
--
GKX Group
GKX Associates Inc.
1-877-GKX-GROUP
ggrothendieck at gmail.com
More information about the R-help
mailing list