I am trying to build R packages locally simply to standardize my code for my own benefit. I've no intention to post on CRAN or GitHub. What I would like to do is import packages I've already developed into a new package I'm developing.
For example:
The problem I'm facing is that when I install pack_b (using devtools::install()
) the following error comes up:
Skipping 1 unavailable package: pack_a
After looking through the code of devtools on GitHub it appears that it is looking on CRAN for the required packages using available.packages()
. Of course my pack_a is not on CRAN so it fails to find it and then pack_b fails to install. I was hoping it would first check if pack_a is already installed in my default library and therefore not even try to re-install it.
So my question comes down to:
How do I specify where to find pack_a on my local drive when installing pack_b? And if that's not possible is there a switch to turn off installation of required packages during install?
A similar question was asked before and I'm not entirely sure but I think one of the suggestions was to add your local path to the repos
argument of install.packages()
. This did not work for me however.
Previous similar question: R package which imports SparkR (not on CRAN)
Any guidance would be much appreciated.
I'm not entirely sure why you are having this issue without more details, as I do exactly as you describe for my own packages (both also not on CRAN) and have no issues.
Having said that, a simple solution if you know for sure that pack_a
is installed before you install pack_b
is to run:
devtools::install(dependencies = FALSE)