Re: [R] extract bits of a character vector

2008-10-22 Thread jonas garcia
Thank you all for the useful responses. Problem solved! J On Thu, Oct 23, 2008 at 12:14 AM, Duncan Murdoch <[EMAIL PROTECTED]>wrote: > On 22/10/2008 5:02 PM, jonas garcia wrote: > >> Dear list: >> >> >> >> I have the following problem: From a vector like this: >> >> vec<- c("mud_1999_area_A", "g

Re: [R] extract bits of a character vector

2008-10-22 Thread Duncan Murdoch
On 22/10/2008 5:02 PM, jonas garcia wrote: Dear list: I have the following problem: From a vector like this: vec<- c("mud_1999_area_A", "gravel_2004_area_F") I would like to get the year in a separate vector, such y<- c("1999", "2004") I´ve been looking to grep() but I'm not sure how

[R] extract bits of a character vector

2008-10-22 Thread jonas garcia
Dear list: I have the following problem: From a vector like this: vec<- c("mud_1999_area_A", "gravel_2004_area_F") I would like to get the year in a separate vector, such y<- c("1999", "2004") I´ve been looking to grep() but I'm not sure how to do this. Help? Thanks in advance J