[R] How to strip one term from a data.frame? + How to write long line in script?
Gabor Grothendieck
ggrothendieck at gmail.com
Mon May 1 13:37:44 CEST 2006
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 <shmilylemon at yahoo.com> 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.
>
> ______________________________________________
> 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
>
More information about the R-help
mailing list