[R] using grep
Greg.Snow at imail.org
Sat Feb 27 18:25:32 CET 2010
Look at the gsubfn package, it gives more options and will probably make what you are trying to do easier.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----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 11:27 AM
> To: r-help at r-project.org
> Subject: [R] using grep
> Hi All,
> I have a character vector with naems of cities in the us. I need to
> the number that appear after the word "New York", for example,
> x<-c("P Los Angeles44AZ", "P New York722AZ", "K New York20")
> I want the results to be
> 722, 20
> cab I use the grep function, if so how?
> I appreciate your help, thanks,
> View this message in context: http://n4.nabble.com/using-grep-
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help