Skip to content
Prev 62903 / 63424 Next

Problems with ::

On 2025-03-19 12:49 p.m., Therneau, Terry M., Ph.D. via R-devel wrote:
For those functions where the "survival::" prefix leads to the wrong 
behaviour, I'd suggest defining a function that always generates an 
error. For example,

cluster <- function(...)
   stop("In the survival package, cluster() is not a real function.  It 
has special meaning in formulas and should only be used there.")


This will conflict with any of those functions (like survival::strata?) 
that are supposed to be meaningful outside of a formula.  In that case 
you'd have to rename either the special or the function, so you use two 
different names, e.g.
rata

strata <- function(...)
   stop("In the survival package version x.y or later, strata() is not a 
real function.  It has special meaning in formulas and should only be 
used there.  Use Strata() outside of a formula.")

Duncan Murdoch