[R] using grep
wwwhsd at gmail.com
Fri Feb 26 19:48:29 CET 2010
gsub(".*York(\\d+).*", "\\1", grep("New York", x, value = TRUE))
On Fri, Feb 26, 2010 at 3:27 PM, kayj <kjaja27 at yahoo.com> wrote:
> Hi All,
> I have a character vector with naems of cities in the us. I need to extract
> 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-tp1571102p1571102.html
> 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-guide.html
> and provide commented, minimal, self-contained, reproducible code.
25° 25' 40" S 49° 16' 22" O
More information about the R-help