[R] Disentagling formulas
ggrothendieck at gmail.com
Mon Oct 1 15:40:59 CEST 2007
fo <- y ~ x
fo[] <- as.name("z")
On 10/1/07, Rebecca Sela <rsela at stern.nyu.edu> wrote:
> I am writing a program in which I would like to take in a formula, change the response (Y) variable into something else, and then pass the formula, with the new Y variable to another function. That is, I am starting with
> formula <- Y~X1+X2+X3
> and I'd like to do something like
> Y <- formula$Y
> newY <- f(Y)
> So far, it seems that my only option will be a very complicated sequence of steps involving match.call(). Is there a simpler way to change the response variable in a formula?
> Thanks in advance!
> Rebecca Sela
> Statistics Department
> Stern School of Business
> New York University
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help