[R] Extracting text from a character string

Wensui Liu liuwensui at gmail.com
Fri Mar 9 22:33:58 CET 2007


actually, I am thinking of strsplit().

On 3/9/07, Shawn Way <shawnwaypublic at yahoo.com> 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 grep function, however I cannot quite get it to work.
>
>   grep("\d\d-\d\d-\d\d\d\d",data3[1],perl=TRUE,value=TRUE)
>
>   Any hints?
>
>   Shawn Way
>
>
> ---------------------------------
> Sucker-punch spam with award-winning protection.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
WenSui Liu
A lousy statistician who happens to know a little programming
(http://spaces.msn.com/statcompute/blog)



More information about the R-help mailing list