[R] basic question re lm()

Gabor Grothendieck ggrothendieck at gmail.com
Fri Aug 11 00:33:52 CEST 2006


Try:

lm(Sepal.Length ~., iris)

On 8/10/06, r user <ruser2006 at yahoo.com> wrote:
> I am using R in a Windows environment.
>
> I have a basic question regarding lm().
>
> I have a dataframe "data1" with ncol=w.
>
> I know that my dependent variable is in column1.
>
> Is there a way to write the regression formula so that
> I can use columns 2 thru w as my independent
> variables?
>
>
>
> e.g. something like:  " lm(data1[,1] ~ data1[,2:w] ) "
>
> Thanks
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list