[R] specifying a model formula on the fly

Allan Strand stranda at COFC.EDU
Tue Jul 4 19:10:40 CEST 2000


Hi All,

I'm trying to specify the formula for a glm based upon the names in
the data.frame.  I always discard the first two variables in the frame
and the third will always be the only response variable.  The problem
appears because I would like to specify the rest of the variables of
the data.frame as independent variables in the formula.  I can't think
of a way to do this cleanly and maintain the names of the independent
variables in the glm object.  I know that I can use as.matrix to cast
the rest of the data.frame as a design matrix, but the glm object
returned has "as.matrix(x)" prepended to the variable names.  I
suspect that I could iterate across the results of name(x) and somehow
use quote() and eval() to solve this problem, but I cannot seem to
make it work.  Any suggestions would be greatly appreciated.

Cheers,
a.

-- 
Allan Strand,   Biology    http://linum.cofc.edu
College of Charleston      Ph. (843) 953-8085
Charleston, SC 29424       Fax (843) 953-5453

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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