[R] replacing characters in formulae / models

Christoph Scherber Christoph.Scherber at agr.uni-goettingen.de
Thu Nov 6 16:50:52 CET 2008


Dear all,

How can I replace text in objects that are of class "formula"?

y="a * x + b"
class(y)="formula"
grep("x",y)
y[1]

Suppose I would like to replace the "x" by "w" in the formula object "y".

How can this be done? Somehow, the methods that can be used in character objects do not work 1:1 in 
formula objects...

Many thanks and best wishes
Christoph



-- 
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany

phone +49 (0)551 39 8807
fax   +49 (0)551 39 8806

Homepage http://www.gwdg.de/~cscherb1



More information about the R-help mailing list