I have developed a local package that depends on others available on CRAN (as an example, pool
). Therefore, when I attempt to install the package using the standard
install.packages("/path/to/package",
repos = NULL,
type = "source")
I get an error because the dependencies aren't installed. install.packages
has an argument dependencies
which by default would try to install those dependencies. However, as stated by the man page (and commented in the linked question below), repos = NULL
means the dependencies are ignored.
To get around that, I used package miniCRAN
to create a repo containing my package, hoping I could do a repos = c("myRepo", getOption("repos"))
to get it to work.
Now I can install my package using
install.packages("package",
repos = c("/path/to/repo", getOptions("repos"),
type = "source")
But only if I've already installed pool
. If not, I still get an error because it can't find the dependencies.
So I called miniCRAN::addPackage("pool")
, which adds that package and its many dependencies to my repo, and they all appear if I call miniCRAN::pkgAvail()
.
However, if I attempt to install my package again, I still get a there is no package called 'pool'
error.
Interestingly, if I try to install pool
itself from the repo, it works.
install.packages("pool",
repos = "/path/to/repo",
type = "source")
install.packages("package",
repos = "/path/to/repo",
type = "source")
Obviously, however, this kind of beats the point of adding pool
to the repo: I might just as well have installed it from CRAN.
So what's going on here, and is this really the only way to install local packages and their CRAN dependencies?