[R] metaprogramming with lm

From: June Kim <juneaftn_at_gmail.com>
Date: Thu, 13 Nov 2008 09:27:14 +0900


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)



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 13 Nov 2008 - 00:29:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 13 Nov 2008 - 01:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive