[Rd] specials and ::

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Mon Aug 26 18:42:03 CEST 2024


On 2024-08-26 12:26 p.m., Chris Black wrote:
> It’s completely reasonable to decline to do extra work to support it, but at the same time: Qualified calls are widely used and recommended, and users are also being completely reasonable when they try to use them (probably without checking the manual!) and expect them to work.

If the issues in survival are the same as the issues I saw in the tables 
package, the way to issue such a message would be to put code like

  if (! ("package:survival" %in% search()))
    stop("'survival' needs to be attached using library() or require()")

in functions that could trigger the problems.

Duncan Murdoch

> 
> Would there be a tolerably easy way to make the fit fail loudly on `survival::strata(…)` rather than return the wrong result?
> 
> 
> 
>> On Aug 26, 2024, at 7:42 AM, Therneau, Terry M., Ph.D. via R-devel <r-devel using r-project.org> wrote:
>>
>> The survival package makes significant use of the "specials" argument of terms(), before
>> calling model.frame; it is part of nearly every modeling function. The reason is that
>> strata argments simply have to be handled differently than other things on the right hand
>> side. Likewise for tt() and cluster(), though those are much less frequent.
>>
>> I now get "bug reports" from the growing segment that believes one should put
>> packagename:: in front of every single instance.   For instance
>>        fit <- survival::survdiff( survival::Surv(time, status) ~ ph.karno +
>> survival::strata(inst),  data= survival::lung)
>>
>> This fails to give the correct answer because it fools terms(formula, specials=
>> "strata").    I've stood firm in my response of "that's your bug, not mine", but I begin
>> to believe I am swimming uphill.   One person responded that it was company policy to
>> qualify everything.
>>
>> I don't see an easy way to fix survival, and even if I did it would be a tremendous amout
>> of work.   What are other's thoughts?
>>
>> Terry
>>
>>
>>
>> -- 
>>
>> Terry M Therneau, PhD
>> Department of Quantitative Health Sciences
>> Mayo Clinic
>> therneau using mayo.edu
>>
>> "TERR-ree THUR-noh"
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list