On 17/12/2013 11:26 AM, Gábor Csárdi wrote:
Dear all,

I am trying to install a private package, with its dependencies. However, both

install.packages("sand_1.0.tar.gz", dependencies=TRUE, repos=NULL,
type="source")

and

install.packages("sand_1.0.tar.gz", dependencies="Suggests",
repos=NULL, type="source")

fail to install suggested packages:

> packageDescription("sand")$Suggests
[1] "network, sna, ape, ergm, mixer, vioplot, ROCR, fdrtool, huge"

Based on the docs, I got the (obviously wrong) impression, that it was
possible to install suggested packages. From ?install.packages,
dependencies argument:

           ‘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).

> library(ergm)
Error in library(ergm) : there is no package called ‘ergm’
> library(huge)
Error in library(huge) : there is no package called ‘huge’

What am I doing wrong, and more importantly, what is the correct way
to install _all_ dependencies of a package?

The problem is with repos=NULL (i.e. a local install). Since none of those dependencies are local, they aren't found and won't be installed.

I imagine some package has a function that does what you want, but I don't know it. It wouldn't be hard to put one together as follows:

1.  install your package without its dependencies.
2. use tools::package_dependencies() to find the (non-recursive) dependencies.
3.  install those, with their dependencies.

You could add a step to filter the list in 2 so that you don't re-install something that is already there.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to