Re: [R] How to strip one term from a data.frame? + How to write long line in script?

From: Gabor Grothendieck <>
Date: Mon 01 May 2006 - 21:37:44 EST

Using the built in data frame iris, which has 5 columns, regress Sepal.Length against all other variables except the last one:

lm(Sepal.Length ~., iris[1:4])

On 5/1/06, Guojun Zhu <> wrote:
> I need to run a regression with 14 normal variables
> and 20 dummy variables. All the data is in a huge
> data.frame df. But there is some extra intermediate
> item in the same data.frame too. It will be nice I
> can strip off those terms and run lm(). Also, is
> there a simple way to write the formula, for example,
> just specify the y term, all other term in data.frame
> should be x_i. Or is there some kind of automatically
> way to build it? like use ls(df) couple with some
> other functions?
> If I have to write it in the brute force way, I will
> need to write a real long line in script. I am in
> windows. I found the script does not work with a long
> line. It will not work either if I break it into a
> few lines. How to get rid of that? thanks.
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!
> mailing list PLEASE do read the posting guide! Received on Mon May 01 21:53:10 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 01 May 2006 - 22:09:56 EST.

Mailing list information is available at Please read the posting guide before posting to the list.