Re: [R] remove all terms with interaction factor in formula

2012-09-13 Thread William Dunlap
> -Original Message- > From: David Winsemius [mailto:dwinsem...@comcast.net] > Sent: Thursday, September 13, 2012 4:15 PM > To: William Dunlap > Cc: Bert Gunter; Alexander Shenkin; r-help@r-project.org > Subject: Re: [R] remove all terms with interaction factor in formula >

Re: [R] remove all terms with interaction factor in formula

2012-09-13 Thread David Winsemius
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. -- David. > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > >> -

Re: [R] remove all terms with interaction factor in formula

2012-09-13 Thread William Dunlap
" Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of David Winsemius > Sent: Thursday, September 13, 2012 11:28 AM > To: Bert Gunter > Cc: Alexand

Re: [R] remove all terms with interaction factor in formula

2012-09-13 Thread David Winsemius
On Sep 13, 2012, at 11:00 AM, Bert Gunter wrote: > ~ a*b*d + a*c*d That seemed pretty clear and obvious, but I started wondering how to tell the machine to do it. Here is another idea: > grep("b:c", attr(terms(~a*b*c*d), "term.labels" ) ,invert=TRUE, value=TRUE) [1] "a" "b" "c" "d

Re: [R] remove all terms with interaction factor in formula

2012-09-13 Thread Bert Gunter
~ a*b*d + a*c*d -- Bert On Thu, Sep 13, 2012 at 10:49 AM, Alexander Shenkin wrote: > Hi Folks, > > I'm trying to find a way to remove all terms in a formula that contain a > particular interaction. > > For example, in the formula below, I'd like to remove all terms that > contain the b:c interacti

[R] remove all terms with interaction factor in formula

2012-09-13 Thread Alexander Shenkin
Hi Folks, I'm trying to find a way to remove all terms in a formula that contain a particular interaction. For example, in the formula below, I'd like to remove all terms that contain the b:c interaction. > attributes(terms( ~ a*b*c*d))$term.labels [1] "a" "b" "c" "d" "a