Re: [R] can lm() automatically take in the independent variables without knowing the names in advance

From: Bjørn-Helge Mevik <bhs2_at_mevik.net>
Date: Mon 09 Oct 2006 - 07:58:26 GMT

HelponR wrote:

> I am trying to use lm to do a simple regression but on a batch of
> different files.
>
> Each file has different column names.
>
> I know the first column is the dependent variable and all the rest are
> explanatory variables.

I believe

> lm(data = thedataframe)

(i.e. with no formula!) will use the first column as response and the rest as predictors.

-- 
Bjørn-Helge Mevik

______________________________________________
R-help@stat.math.ethz.ch 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 Mon Oct 09 18:00:28 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 09 Oct 2006 - 09:30:09 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.