[R] building formula objects

Russell Senior seniorr at aracnet.com
Tue Jul 9 12:48:53 CEST 2002


I want to write a function to take an argument as the response
variable of a linear model, e.g. to do anova's across a list of
variables, something like the following (except, of course, this
doesn't work):

  function(x) { anova(lm(x ~ my.factor,data=my.data)) }

The x in lm() above is getting evaluated at the wrong level.  How
can I make this work? 

-- 
Russell Senior         ``The two chiefs turned to each other.        
seniorr at aracnet.com      Bellison uncorked a flood of horrible       
                         profanity, which, translated meant, `This is
                         extremely unusual.' ''                      
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list