[R] Removing specific v1:v2 combinations from a formula.

Pontarelli, Brett bpontar at amazon.com
Wed Feb 1 02:57:54 CET 2006


Suppose I have a formula

	mfTest = (y ~ a + b + c + d1 + d2 + d3);

When I update the formula

	mfTest2nd = update(mfTest, .~.^2);

I get all the combinations a:b, a:c, etc.  But I don't want the d1:d2, d2:d3, etc. interactions.  I've tried

	mfTest2nd = update(fmTest, .~.^2 - (d1+d2+d3)^2);

But that removes the 1st order variables as well.  Is there a way to remove (with minimal typing) the d_i:d_j interactions only?  Thanks.

--Brett




More information about the R-help mailing list