I have an R package stored on a local git server. This package has a series of dependecies - packages from both CRAN and Bioconductor. Using the devtools
package, I can install from git directly:
library(devtools)
install_git("http://mygitserver.com/username/reponame")
I have noticed that this installation process fails to install all of the Bioconductor dependencies, but all of the CRAN dependencies are installed correctly.
How can I set up the package's dependencies (in the DESCRIPTION
file) so that all of the Bioconductor package dependencies are also installed correctly. I've noticed this is not a problem when the packages are hosted on a Bioconductor mirror and installed via biocLite()
, which suggests that perhaps I could resolve this by listing a set of mirrors for install.packages()
to search through before declaring that the package cannot be found. Is there a way to get all of these dependencies automatically?
The short answer:
setRepositories(ind=1:2)
tl;dr
The documentation for setRepositories
tells us that the "default list of known repositories is stored in the file 'R_Home/etc/repositories'". We can track this down a couple of ways, but for convenience, let's read the table of repositories into R (this will cut off all of the commented documentation in that file, but you can pull that up with readLines
if you're interested.
read.table(file.path(R.home(), "etc", "repositories"), sep = "\t")
menu_name URL default source win.binary mac.binary
CRAN CRAN @CRAN@ TRUE TRUE TRUE TRUE
BioCsoft BioC software %bm/packages/%v/bioc FALSE TRUE TRUE TRUE
BioCann BioC annotation %bm/packages/%v/data/annotation FALSE TRUE TRUE TRUE
BioCexp BioC experiment %bm/packages/%v/data/experiment FALSE TRUE TRUE TRUE
BioCextra BioC extra %bm/packages/%v/extra FALSE TRUE TRUE TRUE
CRANextra CRAN (extras) http://www.stats.ox.ac.uk/pub/RWin FALSE TRUE TRUE TRUE
Omegahat Omegahat http://www.omegahat.org/R FALSE TRUE FALSE FALSE
R-Forge R-Forge http://R-Forge.R-project.org FALSE TRUE TRUE TRUE
rforge.net rforge.net http://www.rforge.net FALSE TRUE TRUE TRUE
CRANextra[https] CRAN (extras, https) https://www.stats.ox.ac.uk/pub/RWin FALSE TRUE TRUE TRUE
R-Forge[https] R-Forge [https] https://R-Forge.R-project.org FALSE TRUE TRUE TRUE
rforge.net[https] rforge.net [https] https://www.rforge.net FALSE TRUE TRUE TRUE
Imagine that each row has an index number. When you call setRepositories(ind = 1:2)
you are telling R to look at the repositories in rows 1 and 2.