From therne@u @end|ng |rom m@yo@edu  Tue Aug  6 14:46:05 2019
From: therne@u @end|ng |rom m@yo@edu (Therneau, Terry M., Ph.D.)
Date: Tue, 06 Aug 2019 07:46:05 -0500
Subject: [Rd] 
 [EXTERNAL] Re: Potential bug in update.formula when updating offsets
In-Reply-To: <5F1A2594-68E6-4A5B-A4C7-AC964474966B@gmail.com>
References: <CAGoSky9QAyfxW6bxzkVACQGX95SR2H-9rt2H2+EnF_Db_tDcLg@mail.gmail.com>
 <5F1A2594-68E6-4A5B-A4C7-AC964474966B@gmail.com>
Message-ID: <771925$c60o2u@ironport10.mayo.edu>

Yes, it is almost certainly the same issue.? At useR I promised Martin that I would put 
together a clear example and fix for him and I have not yet done so.? I will try to do 
that this week.

 ? The heart of the issue is that in a terms object the offset expression will apear in 
the 'variables' attribute but not in the 'term.labels' or 'order' attributes, and the base 
code tries to use the same subscripting vector for all 3 if then. ? The same bit of code 
shows up in update.formula and in [.formula; a fix for one can be applied to both.

I had all this worked out, then had some problems logging into buzilla, then sent it to 
Martin about the same time 2-3 more urgent things got dumped on him, and then we've both 
let it lie. At useR he said (and I've no reason to disagree) that my prior note was 
unclear.? Let me recreate the example and fix, more carefully.

Terry T.


On 8/6/19 3:21 AM, peter dalgaard wrote:
> Terry, Martin
>
> Would this happen to be related to the "indexing term objects" issue that has been bothering you?
>
> -pd
>
>> On 5 Aug 2019, at 21:44 , Paul Buerkner <paul.buerkner at gmail.com> wrote:
>>
>> Hi all,
>>
>> update.formula does not seem to correctly update (i.e. remove in my case)
>> offset terms.
>>
>> Here is an example:
>>
>> update(~x + offset(z), ~ . - offset(z))
>>> ~x + offset(z)
>> Also:
>> update(~x, ~ . - offset(z))
>>> ~x + offset(z)
>> In both cases, I would expect the result
>>> ~x
>> as  - <term>  should remove <term> from the formula as happens for instance
>> in:
>>
>> update(~x + z, ~ . - z)
>>> ~x
>> I don't know if this behavior is intentional but I would say it is at least
>> unfortunate.
>>
>> Paul
>>
>> 	[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel


	[[alternative HTML version deleted]]



[Rd] [EXTERNAL] Re: Potential bug in update.formula when updating offsets
Therneau, Terry M., Ph.D.