[R-pkg-devel] DESCRIPTION file Imports of base R packages

Aixiang Jiang @|j|@ng @end|ng |rom bccrc@c@
Tue Oct 3 19:34:04 CEST 2023


Thank you - all!

Aixiang
________________________________________
From: R-package-devel <r-package-devel-bounces using r-project.org> on behalf of Henrik Bengtsson <henrik.bengtsson using gmail.com>
Sent: Tuesday, October 3, 2023 8:50 AM
To: Jan Gorecki
Cc: List r-package-devel
Subject: Re: [R-pkg-devel] DESCRIPTION file Imports of base R packages

This email came from an EXTERNAL SENDER. If you think this message is suspicious, please do not open any attached files or links, and forward it as an attachment to spammail using bccrc.ca



On Tue, Oct 3, 2023 at 7:46 AM Jan Gorecki <j.gorecki using wit.edu.pl> wrote:
>
> Hello,
>
> I noticed some packages define Imports in DESCRIPTION file listing base R
> packages like methods, utils, etc.
>
> My question is that if it is necessary to list those* dependencies in
> DESCRIPTION file, or is it enough to have them listed in NAMESPACE file?

You do *not* have to declare base-R packages as dependencies in the
DESCRIPTION file.  'R CMD check' and 'R CMD check --as-cran' will not
complain about them.

I can't speak for others, but, I choose to declare all(*) my base-R
package dependencies in my DESCRIPTION files for a reason.  This makes
it explicit what packages my package rely on, including which of the
base-R packages.  For instance, it's nice to be able to tell when the
'parallel' or 'tcltk' package is used from the DESCRIPTION file (and
the online CRAN package page, if on CRAN).

(*) The exception is the 'base' package, because that is such a
fundamental package in R and is always loaded.  The other base-R
packages are theoretically optional when it comes to running R, e.g.

$ R_ENABLE_JIT=0 Rscript --vanilla --default-packages=base -e
"loadedNamespaces()"
[1] "base"

/Henrik

>
> * by "those" I mean packages listed by:
>
> in tools:::.get_standard_package_names()$base
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

______________________________________________
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