From therneau at mayo.edu  Thu Mar  8 17:24:49 2018
From: therneau at mayo.edu (Therneau, Terry M., Ph.D.)
Date: Thu, 08 Mar 2018 10:24:49 -0600
Subject: [Rd] [EXTERNAL] Re:  Fwd: Re: Re: backquotes and term.labels
In-Reply-To: <CABghstR_oezPZt4ch5xm38BFKEHhZOTZXE3sKLjwvR7zm6J9gA@mail.gmail.com>
References: <d0ca8b9a-bcf6-f01b-a4c2-445e28cb7fa4@mayo.edu>
 <fd55f7$91bjv9@ironport10.mayo.edu>
 <CABghstR_oezPZt4ch5xm38BFKEHhZOTZXE3sKLjwvR7zm6J9gA@mail.gmail.com>
Message-ID: <fd55f7$91cvba@ironport10.mayo.edu>

Ben,
I looked at the source code you pointed out, and the line
     fr <- fr[attr(terms(fr),"varnames.fixed")]

sure looks to me as though the terms() function has returned an object with a 
varnames.fixed attribute.  Either that or your code has inside knowledge that a reader 
like me won't know.  Given what you said I will guess that terms(x) returns the terms 
attribute of x if that already exists, doing no processing, and you know that fr has 
already been thusly modified?

I have code that uses the variables, term.names, and factors attributes of the terms() 
structure, and all of those have the backticks.  I know the second two will currently 
break the coxme and survival packages, I haven't chased down the effect on the first.


On 03/08/2018 08:42 AM, Ben Bolker wrote:
> Meant to respond to this but forgot.
> 
>   I didn't write a new terms() function  -- I added an attribute to the
> terms() (a vector of the names
> of the constructed model matrix), thus preserving the information at
> the point when it was available.
>    I do agree that it would be preferable to have an upstream fix ...
>



[Rd] [EXTERNAL] Re: Fwd: Re: Re: backquotes and term.labels
Therneau, Terry M., Ph.D.