[R-pkg-devel] Should 'methods' be in Imports?
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Thu Mar 16 16:56:53 CET 2023
I think the Writing R Extensions manual is pretty clear about this:
yes, you should include "methods" in Imports or Depends if you are
calling methods::<fn>.
You say "some packages do so and some don't". Which ones don't? It's
helpful to be specific in your examples.
Duncan Murdoch
On 16/03/2023 11:29 a.m., Noah Greifer wrote:
> Hello developers,
>
> I am wondering if base packages whose functions are used in my package need
> to be present in Imports in my DESCRIPTION. For example, if I use the
> function abline(), which exists in the *graphics* package, do I need to
> include *graphics* in Imports? Note I am not asking about whether I need to
> import all or any function from the *graphics* package, that is, assume I
> am using graphics::abline(), etc. I am solely asking about the DESCRIPTION
> file, not the Namespace.
>
> I ask because there seems to be some ambiguity about this. I received a
> pull request from someone adding *methods* to my Imports after noticing I
> didn't declare it when using a function from *methods* (accessed in my
> package using ::). Looking on StackOverflow, there seems to be confusion
> about this. The most relevant question I could find was this one
> <https://stackoverflow.com/q/39439006/6348551>. The question was marked as
> a duplicate despite the linked duplicate being separate from it (i.e.,
> asking about the Namespace, not the DESCRIPTION). Similarly, the answer to
> the question does not address the question, again referring to the
> Namespace and making an irrelevant distinction between Depends and Imports.
> Some of the comments reference a CRAN policy, and yet that policy does not
> seem to be implemented since many packages (including all of mine) omit the
> base packages from the DESCRIPTION.
>
> So, is it optional to include these packages in the DESCRIPTION? I see some
> packages do so and some don't. Is including these packages filling the
> DESCRIPTION with unnecessary dependencies that are automatically satisfied,
> or is it being helpfully explicit about the packages your package relies
> on? Thanks.
>
> Noah
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list