Skip to content
Prev 305437 / 398506 Next

remove all terms with interaction factor in formula

On Sep 13, 2012, at 11:53 AM, William Dunlap wrote:

            
It's probably a black mark against my abilities to do logic manipulations, but it made a lot more sense when I wrote it (admittedly the same meaning)  as :

colnames(fm)[ !(fm["b",]==1 & fm["c",]==1) ]

Here's a grepping method that only requires that the order be a.d in any term:
grep("a.+d", attr(terms(~a*b*c*d), "term.labels" ) ,
           invert=TRUE, value=TRUE), collapse="+") ) )
~a + b + c + d + a:b + a:c + b:c + b:d + c:d + a:b:c + b:c:d

I think that if you are working with a*b*c*d that the order will always be a-before-d.