[R-pkg-devel] DESCRIPTION file Imports of base R packages
Henrik Bengtsson
henr|k@bengt@@on @end|ng |rom gm@||@com
Tue Oct 3 17:50:14 CEST 2023
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
More information about the R-package-devel
mailing list