[R] remove higher order interaction terms

Liviu Andronic landronimirc at gmail.com
Wed Apr 17 14:38:24 CEST 2013


On Wed, Apr 17, 2013 at 2:33 PM, Marc Schwartz <marc_schwartz at me.com> wrote:
> If you only want up to say second order interactions:
>
>> summary(lm(mpg ~ (cyl + disp + hp + drat) ^ 2, data = mtcars))
>
This is what I was looking for. Thank you so much.


> This is covered in ?formula
>
Indeed. I tried to parse ?formula at several occasions in the past few
years, but never quite grasped it fully.

Thanks again,
Liviu



More information about the R-help mailing list