[R] using grep
William Dunlap
wdunlap at tibco.com
Sat Feb 27 00:03:23 CET 2010
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of kayj
> Sent: Friday, February 26, 2010 12:02 PM
> To: r-help at r-project.org
> Subject: Re: [R] using grep
>
>
> Hi ,
>
> I have tried
>
> gsub(".*York(\\d+).*", "\\1", grep("New York", x, value = TRUE))
>
> and outputs
>
> "P New York722AZ" "K New York20"
> but that is not what i want, I want the output to be
>
> 722,20
Does it work if you replace the "\\d" in
the pattern with "[0-9]"? If so, your
regular expression code doesn't recognize
the "\\d" to mean "a decimal digit".
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
>
>
> --
> View this message in context:
> http://n4.nabble.com/using-grep-tp1571102p1571251.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list