Re: [R] Extracting text from a character string

2007-03-09 Thread Wensui Liu
actually, I am thinking of strsplit(). On 3/9/07, Shawn Way <[EMAIL PROTECTED]> wrote: > I have a set of character strings like below: > > > data3[1] > [1] "CB01_0171_03-27-2002-(Sample 26609)-(126)" > > > > I am trying to extract the text 03-27-2002 and convert this into a date for > the sam

Re: [R] Extracting text from a character string

2007-03-09 Thread Gabor Grothendieck
Try this: library(gsubfn) x <- "CB01_0171_03-27-2002-(Sample 26609)-(126)" unlist(strapply(x, "..-..-")) The gsubfn home page is at: http://code.google.com/p/gsubfn/ On 3/9/07, Shawn Way <[EMAIL PROTECTED]> wrote: > I have a set of character strings like below: > > > data3[1] > [1] "CB01_01

[R] Extracting text from a character string

2007-03-09 Thread Shawn Way
I have a set of character strings like below: > data3[1] [1] "CB01_0171_03-27-2002-(Sample 26609)-(126)" > I am trying to extract the text 03-27-2002 and convert this into a date for the same record. I keep looking at the grep function, however I cannot quite get it to work. grep("\d\d-\d\d

Re: [R] Extracting text from a character string

2007-03-09 Thread Marc Schwartz
On Fri, 2007-03-09 at 15:23 -0500, Shawn Way wrote: > I have a set of character strings like below: > > > data3[1] > [1] "CB01_0171_03-27-2002-(Sample 26609)-(126)" > > > > I am trying to extract the text 03-27-2002 and convert this into a date > for the same record. I keep looking at the g

Re: [R] Extracting text from a character string

2007-03-09 Thread Greg Snow
. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Shawn Way > Sent: Friday, March 09, 2007 1:12 PM > To: r-help@stat.math.ethz.ch > Subject: [R] Extr

[R] Extracting text from a character string

2007-03-09 Thread Shawn Way
I have a set of character strings like below: > data3[1] [1] "CB01_0171_03-27-2002-(Sample 26609)-(126)" > I am trying to extract the text 03-27-2002 and convert this into a date for the same record. I keep looking at the grep function, however I cannot quite get it to work. grep("\d\d-\

[R] Extracting text from a character string

2007-03-09 Thread Shawn Way
I have a set of character strings like below: > data3[1] [1] "CB01_0171_03-27-2002-(Sample 26609)-(126)" > I am trying to extract the text 03-27-2002 and convert this into a date for the same record. I keep looking at the grep function, however I cannot quite get it to work. g