Subject: [R] specifying a model formula on the fly
From: Allan Strand (stranda@COFC.EDU)
Date: Wed 05 Jul 2000 - 03:10:40 EST
Message-ID: <86wvj1254f.fsf_-_@linum.cofc.edu>
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@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This archive was generated by hypermail 2b25 : Thu 01 Feb 2001 - 16:14:16 EST