[Rd] [EXTERNAL] Re: Re: all.equal failure
Martin Maechler
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Fri Apr 5 17:58:55 CEST 2019
>>>>> Martin Maechler
>>>>> on Fri, 5 Apr 2019 17:33:54 +0200 writes:
>>>>> Duncan Murdoch
>>>>> on Fri, 5 Apr 2019 11:12:48 -0400 writes:
>> On 05/04/2019 10:46 a.m., Therneau, Terry M., Ph.D. wrote:
>>>
>>>
>>> On 4/5/19 9:39 AM, Duncan Murdoch wrote:
>>>> On 05/04/2019 10:19 a.m., Therneau, Terry M., Ph.D. wrote:
>>>>> Duncan,
>>>>> I should have included it in my original note, but
>>>>>
>>>>> all.equal(unclass(t0x), unclass(t1x))
>>>>>
>>>>> returns TRUE as well. I had tried that as well. But a further look at
>>>>> all.equal.default shows the following line right near the top:
>>>>> if (is.language(target) || is.function(target))
>>>>> return(all.equal.language(target, current, ...))
>>>>>
>>>>> and that path explicitly ignores attributes.
>>>>
>>>> Which R version are you using? I see deparse(target) and deparse(current) in
>>>> all.equal.language(), and those should not be ignoring attributes according to the
>>>> documentation.
> But the problem is that indeed "of course" all.equal.formula()
> and not all.equal.language() is called for the terms since as
> you yourself remarked, their class is c("terms", "formula"),
> and so what Terry reported is indeed correct *and* a bug
> and in "all versions" of R (I did not look far back, but these things
> haven't changed much).
> The cleanest would probably be to define an all.equal.terms()
> method, as I think there may be more code relying on the
> behavior of all.equal.formula() to only look at the formulas
> themselves and not their attributes...
> but you (Duncan) and others may have a different opinion.
and I do agree with Duncan even more now that indeed it's very
unsatisfactory that deparse() {and dput(), dump() ..} of a terms
object would only reproduce the formula and nothing else;
and yes that's all in the C code:
--> src/main/deparse.c
--> in function deparse2buff()
--> inside the (350 lines large) 'case LANGSXP'.
Martin
More information about the R-devel
mailing list