[R] regex in R

Gabor Grothendieck ggrothendieck at myway.com
Mon Mar 22 07:46:22 CET 2004



Here are two ways:


sub( "[.].*","" ,i )

unlist( strsplit( i, split="[.]" ) )[1]

---
Date:   Sun, 21 Mar 2004 22:27:42 -0800 (PST) 
From:   Fred J. <phddas at yahoo.com>
To:   r help <r-help at stat.math.ethz.ch> 
Subject:   [R] regex in R 

 
Hello
I could use some help here with trying to use perl
stype regex to extract the first group of letters
before a ( . )
so if I have a sting AACEE.adiid and wanting AACEE 
i <- "AACEE.adiid"
grep(".+\..?+",i,perl=T)
I must be doing somthing wrong but don't know what it
is?

thanks




More information about the R-help mailing list