[Rd] Suggestions for manipulating formula objects
Thomas Lumley
tlumley at u.washington.edu
Thu Apr 21 01:47:12 CEST 2005
On Wed, 20 Apr 2005 rlee at fpcc.net wrote:
> I'm trying to manipulate/change a formula prior to passing it to another
> function. A simplified example:
>
> User passes formula to my function: y~x
> My function does: lm(transform(y)~x)
>
> Here, transform() is added to the model's response.
>
> What is the best way to accomplish this?
One way is
formula[[2]]<-substitute(transform(y),list(y=formula[[2]]))
-thomas
More information about the R-devel
mailing list