[Rd] [EXTERNAL] Re: Potential bug in update.formula when updating offsets

Therneau, Terry M., Ph.D. therne@u @end|ng |rom m@yo@edu
Tue Aug 6 14:46:05 CEST 2019


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 using 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 using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel


	[[alternative HTML version deleted]]



More information about the R-devel mailing list