Re: [R] regexp help needed.

2009-08-28 Thread Carlos Gonzalo Merino Mendez
Thanks, this what I was looking for. From: Henrique Dallazuanna Cc: r-help@r-project.org Sent: Friday, August 28, 2009 1:42:25 PM Subject: Re: [R] regexp help needed. See this example: Str <- c("345asd", "31qwe", "234tyu"

Re: [R] regexp help needed.

2009-08-28 Thread Henrique Dallazuanna
See this example: Str <- c("345asd", "31qwe", "234tyu", "40kjhg") grep("^3", Str, value = TRUE) split(Str, substr(Str, 1, 1)) On Fri, Aug 28, 2009 at 7:29 AM, Carlos Gonzalo Merino Mendez < carlosgmer...@yahoo.com> wrote: > Hi, > > I posted yesterday with a problem in a script. I still have the

[R] regexp help needed.

2009-08-28 Thread Carlos Gonzalo Merino Mendez
Hi, I posted yesterday with a problem in a script. I still have the same problem, but I think I found a better way to explain my problem. I have a vector of character strings. Each string is unique, including numbers and letters. In the real world they represent a list of codes, so each positio

Re: [R] regexp help needed

2008-11-28 Thread Gabor Grothendieck
On Fri, Nov 28, 2008 at 5:51 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Lauri Nikkinen wrote: >> Hello, >> >> I have a vector of dates and I would like to grep the year component >> from this vector (= all digits >> after the last punctuation character) >> >> dates <- c("28.7.08","28.7.2008","

Re: [R] regexp help needed

2008-11-28 Thread Peter Dalgaard
Lauri Nikkinen wrote: > Hello, > > I have a vector of dates and I would like to grep the year component > from this vector (= all digits > after the last punctuation character) > > dates <- c("28.7.08","28.7.2008","28/7/08", "28/7/2008", "28/07/2008", > "28-07-2008", "28-07-08") > > the resultin

Re: [R] regexp help needed

2008-11-28 Thread Kornelius Rohmeyer
Lauri Nikkinen: > Hello, > > I have a vector of dates and I would like to grep the year component > from this vector (= all digits > after the last punctuation character) > > dates <- c("28.7.08","28.7.2008","28/7/08", "28/7/2008", "28/07/2008", > "28-07-2008", "28-07-08") > > the resulting vect

[R] regexp help needed

2008-11-28 Thread Lauri Nikkinen
Hello, I have a vector of dates and I would like to grep the year component from this vector (= all digits after the last punctuation character) dates <- c("28.7.08","28.7.2008","28/7/08", "28/7/2008", "28/07/2008", "28-07-2008", "28-07-08") the resulting vector should look like "08" "2008" "08