From bbolker at gmail.com  Thu Mar  8 18:51:15 2018
From: bbolker at gmail.com (Ben Bolker)
Date: Thu, 8 Mar 2018 12:51:15 -0500
Subject: [Rd] [EXTERNAL] Re:  Fwd: Re: Re: backquotes and term.labels
In-Reply-To: <fd55f7$91cvb9@ironport10.mayo.edu>
References: <d0ca8b9a-bcf6-f01b-a4c2-445e28cb7fa4@mayo.edu>
 <fd55f7$91bjv9@ironport10.mayo.edu>
 <CABghstR_oezPZt4ch5xm38BFKEHhZOTZXE3sKLjwvR7zm6J9gA@mail.gmail.com>
 <fd55f7$91cvb9@ironport10.mayo.edu>
Message-ID: <001cc8ed-aabe-cfc6-d46b-7ea0f9b3b05e@gmail.com>


  That's more or less right.  We wrote a terms.merMod method, which
accesses the terms component of the @frame slot, which we have modified
upstream ...

  Do you mean term.labels rather than term.names?

BTW ?terms.object says (under the "term.labels" element):

 Non-syntactic names will be quoted by backticks: this makes
          it easier to re-construct the formula from the term labels.

  This suggests, alas, that this was an intentional design decision --
so harder to change.

  cheers
   Ben


On 18-03-08 11:24 AM, Therneau, Terry M., Ph.D. wrote:
> 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
Ben Bolker