[R] regular expressions, sub

paul sorenson sourceforge at metrak.com
Fri Jan 27 12:16:19 CET 2006


There are some interactive regex tools around.  I use a python one 
sometimes.  You just then have to be careful re escaping and the style 
of regular expressions used in the tool you worked with and the target 
environment.

Christian Hoffmann wrote:
> Hi,
> 
> I am trying to use sub, regexpr on expressions like
> 
>     log(D) ~ log(N)+I(log(N)^2)+log(t)
> 
> being a model specification.
> 
> The aim is to produce:
> 
>     "ln D ~ ln N + ln^2 N + ln t"
> 
> The variable names N, t may change, the number of terms too.
> 
> I succeded only partially, help on regular expressions is hard to 
> understand for me, examples on my case are rare. The help page on R-help 
> for grep etc. and "regular expressions"




More information about the R-help mailing list