[R] metaprogramming with lm

June Kim juneaftn at gmail.com
Thu Nov 13 01:27:14 CET 2008


Hello,

Say I want to make a multiple regression model with the following expression:

lm(y~x1 + x2 + x3 + ... + x_n,data=mydata)

It gets boring to type in the whole independent variables, in this
case x_i. Is there any simple way to do the metaprogramming for this?
(There are different cases where the names of the independent
variables might sometimes have apparent patterns or not)



More information about the R-help mailing list