[R-pkg-devel] recursive dependencies and install.packages()

John Fox jfox at mcmaster.ca
Wed Aug 19 21:57:24 CEST 2015

Dear list members,

My question was prompted by a message from a user indicating that loading
the Rcmdr package following installation via install.packages("Rcmdr")
failed in the manner I indicated, with the indirect dependency ggplot2

I thought that I was able to duplicate this error by deleting the Rcmdr,
RcmdrMisc, Hmisc, and ggplot packages from the R 3.2.2 library on my Windows
10 system and then reinstalling the Rcmdr package via
install.packages("Rcmdr"). But when I tried installing the Rcmdr on a
Windows (8) machine with a newly installed R 3.2.2, I was unable to
duplicate the error. That is, everything worked fine, including the
recursively installed ggplot2 dependency.

I subsequently uninstalled R 3.2.2 from my Windows 10 machine, deleted the R
3.2.2 library, and reinstalled R 3.2.2 and the Rcmdr package. Again,
everything worked as expected.

So I expect that my original message reflected idiosyncratic errors (the
source of which I don't understand) -- and that recursive dependencies are
in fact resolved as I understood, and as implied by ?install.packages.

My apologies for what appears to be a false alarm.


> -----Original Message-----
> From: R-package-devel [mailto:r-package-devel-bounces at r-project.org] On
> Behalf Of John Fox
> Sent: Wednesday, August 19, 2015 3:16 PM
> To: r-package-devel at r-project.org
> Subject: [R-pkg-devel] recursive dependencies and install.packages()
> 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/
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

More information about the R-package-devel mailing list