[R] Playing with formulae

Thomas Lumley tlumley at u.washington.edu
Sat Sep 13 04:01:26 CEST 2003


On Fri, 12 Sep 2003, Ross Boylan wrote:
>
> Is attr(t, "variables")[[response+1]] always the right term, though it
> may not be of class name if the response is an expression?

Yes

> > The "factors" attribute has row names corresponding to variables and
> > column names corresponding to terms.
> >
> Is the first row name always the response (though it may not be a simple
> variable name)?

Yes.  In fact it's the attr(,"response")th rowname, but this always is
first.

>
> By the way, do you or anyone know what's special about specials?  The
> only thing the documentation mentioned (that I saw) was that terms that
> were special were flagged as such.

That *is* all that's special.  terms() has an option for you to specify
terms as special, and those terms are then flagged as special.

So coxph uses terms(formulas, specials=c("strata","cluster")) to mark
strata() and cluster() terms as special.


	-thomas




More information about the R-help mailing list