[R] constructing a formula

Michaell Taylor pols1oh at bestweb.net
Mon Aug 5 23:52:38 CEST 2002


Dear Listers,

I am having trouble figuring out how to build a formula using a variable
list.  For example, I have:

a _ data.frame(a=rnorm(1000))
a$b_rnorm(1000)+.5*a$a
a$c_rnorm(1000)+.5*a$b
a$d_rnorm(1000)+.5*a$b+.1*a$a
attach(a)

and I estimate,

lm(d ~ b+c+d)

BUT,

I wish to construct a generalized solution in which, 

ListOfVar _ c('b','c','d')

The question is how to leverage ListOfVar into the constuction of the
formula lm(a$d ~ a$b+a$c+a$b).  I know this must be fairly simple, but
unfortunately my readings of the various help files/books haven't been
productive yet.

Any help would be appreciated.  Thanks in advance.

Michaell Taylor

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