I'm using devtools and I have some packages on github. I would like to create dependencies between them, so when I run install_github(...)
the other github packages that are in the DESCRIPTION file listed as Imports will also be installed. Can I do this or is there another thing people do?
Currently if I add a package to Imports that isnt available on CRAN I simply get a message "Skipping ... packages not available: xxx" when I run install_github
.
You can add a github dependency in the DESCRIPTION file with Remotes:
like this:
Imports:
mypackage
Remotes:
mygithub/mypackage
See https://cran.r-project.org/web/packages/devtools/vignettes/dependencies.html for how to add non-github dependencies.
Trying to get R's package loaders to install from github sounds like a rabbit hole.
Instead, use something like this in your package's .onload()
method.
# install these from github, not CRAN:
pkglist <- list(
c(name='ggplus',url='guiastrennec/ggplus'),
c(name='DT',url='rstudio/DT'))
for(pkg in pkglist)
if(!suppressWarnings(suppressPackageStartupMessages(require(pkg['name'],
quietly=TRUE,character.only=TRUE)))){
devtools::install_github(pkg['url'])
suppressPackageStartupMessages( library(pkg['name'],character.only=TRUE))
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With