[R-pkg-devel] recursive dependencies and install.packages()
John Fox
jfox at mcmaster.ca
Wed Aug 19 21:15:47 CEST 2015
Dear list members,
I'm pretty sure (from memory) that this was discussed before but I can't
find a relevant thread.
The Rcmdr packages "depends" on the RcmdrMisc package which "depends" on the
Hmisc package which "imports" the ggplot2 package.
When the Rcmdr package is installed via install.packages("Rcmdr"), i.e.,
with all arguments other than pkgs at their defaults, the RcmdrMisc and
Hmisc packages are installed but not ggplot2, causing the Rcmdr to fail to
load, unless ggplot2 is installed directly.
>From ?install.packages I see:
---------- snip ---------
Dependencies:
logical indicating whether to also install uninstalled packages which these
packages depend on/link to/import/suggest (and so on recursively). Not used
if repos = NULL. Can also be a character vector, a subset of c("Depends",
"Imports", "LinkingTo", "Suggests", "Enhances").
Only supported if lib is of length one (or missing), so it is unambiguous
where to install the dependent packages. If this is not the case it is
ignored, with a warning.
The default, NA, means c("Depends", "Imports", "LinkingTo").
TRUE means to use c("Depends", "Imports", "LinkingTo", "Suggests") for pkgs
and c("Depends", "Imports", "LinkingTo") for added dependencies: this
installs all the packages needed to run pkgs, their examples, tests and
vignettes (if the package author specified them correctly).
In all of these, "LinkingTo" is omitted for binary packages.
---------- snip ---------
from which I infer, obviously incorrectly, that the three-deep recursive
dependency on ggplot2 would cause it to be installed.
So, two questions:
(1) What is the correct understanding of how recursive dependencies are
handled by install.packages() with default arguments?
(2) What is the best fix assuming that naïve users will use
install.packages() with default arguments? I can specify that RcmdrMisc
"imports" ggplot2, which I believe will cause ggplot2 to be installed when
the Rcmdr package is installed, since the recursive dependency would then be
two deep, which apparently works. Is that a reasonable solution? (It seems
like a kludge to me.)
Thanks for any help,
John
-----------------------------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.socsci.mcmaster.ca/jfox/
More information about the R-package-devel
mailing list