[Rd] [EXTERNAL] Re: Fwd: Re: Re: backquotes and term.labels

Ben Bolker bbolker at gmail.com
Thu Mar 8 18:51:15 CET 2018


  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 ...
>>



More information about the R-devel mailing list