[Rd] specials and ::

Therneau, Terry M., Ph.D. therne@u @end|ng |rom m@yo@edu
Tue Aug 27 02:06:50 CEST 2024


The survival package itself has a tiny list of reverse imports, so there is no savings from avoiding the survival namespace.   (I don’t have a choice: since it is on the recommended list I can only depend on base and recommended.  The vignettes in particular would be nicer in knitr than Sweave…).   So yes, I think that avoiding this particular namespace is being a bit excessive.

The penchant of tidy users to “import the universe” is a separate issue.   I have colleagues with a dozen “standard”s that they place at the top of every analysis file whether they need them or not.   I work in medical research and it is important to be able to exactly recreate an analysis later, e.g., when a paper review or more seriously an FDA auditor appears, adding lots of dependencies just makes that harder.  But that is a within-group debate that I will lose (“old fogey”).

But perhaps most pertinent: I understand using survival::coxph() on the outer call, but futher adding survival::Surv or survival::strata or … WITHIN  said call is completely unnecessary, since the routine looks in its own namespace first.   (Unless you start mucking about with the language model, with posix rather likes to do…)

Terry T

From: Josiah Parry <josiah.parry using gmail.com>
Date: Monday, August 26, 2024 at 5:09 PM
To: Therneau, Terry M., Ph.D. <therneau using mayo.edu>
Cc: r-devel using r-project.org <r-devel using r-project.org>
Subject: [EXTERNAL] Re: [Rd] specials and ::
I wouldn't go so far as to call people who don't want to wholesale attach namespaces as "nuts."

{survival} is provided via the {censored} R package to integrate into the {tidymodels} ecosystem.
And the reverse imports of the package is massive! Assuming that each and every one of them
should attach the entire namespace is a bit presumptuous!

I am one of those nuts that likes to namespace everything. It just takes one conflicting method to
taint it :)



On Mon, Aug 26, 2024 at 12:44 PM Therneau, Terry M., Ph.D. via R-devel <r-devel using r-project.org<mailto:r-devel using r-project.org>> wrote:
Thanks to all for the responses. A couple notes It is nice to get the overall feedback
that I'm not nuts to be terribly annoyed by this, and don't need to fix it tomorrow.
Berwin 's note brings to mind the old adage that "The reason it is so hard to make things
foolproof is that fools are so ingeneous." 1. Using survival::strata(inst) in the rhs of
the survdiff call does not generate an error message. Because the stata function is not
recognized as special one instead gets the wrong answer. (Or I should say, "the correct
answer to a different question".) Ditto for most of the rest of the package functions. The
very worst kind of bug. 2. Using specials =c("strata", "survival::strata") could work. I
always process the result with a small "untangle.specials" function, a leftover from when
R and Splus returned slightly different formula structures. I could put post-processing
there. I'll think on this some more. But Ivan's follow-up was not encouraging. 3. Bill's
suggestion to pre-fix the formula. Not a bad idea. If I followed the Call <- match.call()
that lives at the top of my code by an immediate fix of the formula portion of the list,
then all else would flow. And as perhaps a bit of a snark, the user would see the
corrected form in their printout. The nuts who want to call a survival routine without
attaching the name space will be out of luck though. Terry
        [[alternative HTML version deleted]]

______________________________________________
R-devel using r-project.org<mailto: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