> test <- model.frame(Employed ~ Year + poly(GNP,3) + Population, data=longley) > mterm <- terms(test) > names(attributes(mterm)) [1] "variables" "factors" "term.labels" "order" "intercept" [6] "response" "class" ".Environment" "predvars" "dataClasses" > names(attributes(drop.terms(mterm,3))) [1] "variables" "factors" "term.labels" "order" "intercept" [6] "response" "class" ".Environment" Why do I care? In model.matrix.coxph any cluster() term is removed from the terms before calling model.matrix.default; this loses the predvars for terms that I keep. Ditto for strata() terms, since they could possibly generate thousands of columns that I don't need, e.g., matched case-control data. model.matrix.coxph currently has a simple workaround which could be copied. I don't know what other modeling routines may use specials in their formula that will not be a part of the model matrix.

The docs in ?terms.object don't mention a "predvars" component, so that might be why it was dropped. However, various other functions make use of it, so it really should be kept, and should be documented. Can you write a couple of lines about what the "predvars" component is supposed to contain?

I'll fix this for predvars and dataClasses in drop.terms and [.terms in R-devel, and eventually port to R-patched if this doesn't cause worse problems.

Now ported to R-patched as well.