[R] too many var in lm

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Wed Aug 17 15:39:25 CEST 2011


Hi Carol,
it might be another question if it is sensible to use 2100 regression
parameters, but you can use . to regress one response against all other
variables in a data frame as in:

lm(formula = mpg ~ ., data = mtcars)

and you can even exclude specific variables using "-"
lm(formula = mpg ~ . - wt, data = mtcars)

cheers.

Am 17.08.2011 15:23, schrieb carol white:
> Hello,
> It might be an easy question but if you have many variables to fit in the lm function, how do you take all without specifying var1+var2+...+var2100 in the terms parameter in response ~ terms?
> 
> Cheers,
> 
> Carol
> 
> ______________________________________________
> 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.

-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



More information about the R-help mailing list