Create an R package that depends on another R package located on GitHub Create an R package that depends on another R package located on GitHub r r

Create an R package that depends on another R package located on GitHub


This question seems to have been answered quite recently, addressed in this issue of the devtools' github repository.


Package developer POV:

  1. do:

    usethis::use_package("jvamisc")devtools::document()

to add the dependency in the Imports field of your DESCRIPTION file.

  1. manually add a field "Remotes:" in the DESCRIPTION file, specifying where on github R should look for the package:

    #in DESCRIPTIONImports: ...,  jvamisc,  ...Remotes: JVAdams/jvamisc

End-user POV:

  1. the end user has to have the latest development version of devtools (or at least the one corresponding to commit #f21ca3516c). You have to somehow 'force him' to update his devtools version (I guess just put this in the installation instructions... Can't think of a better way)

    devtools::install_github(“hadley/devtools”, ref = “f21ca3516c”)
  2. Restart the R Session on unload/reload the devtools package.

  3. do the usual install_github:

    require(devtools)devtools::install_github("user/LW1949")

I guess this functionality will be added sooner or later to the CRAN version of devtools, so there will be no need for the user to fetch the dev version and he would go directly to step 3).


The steps and additional options are detailed in this vignette.


The actual solution seems to add in your DESCRIPTION file the line

Remotes: hadley/testthat

see the documentation of devtools :

# GitRemotes: git::https://github.com/hadley/ggplot2.git# BitbucketRemotes: bitbucket::sulab/mygene.r@default, dannavarro/lsr-package# BioconductorRemotes: bioc::3.3/SummarizedExperiment#117513, bioc::release/Biobase# SVNRemotes: svn::https://github.com/hadley/stringr# URLRemotes: url::https://github.com/hadley/stringr/archive/master.zip# LocalRemotes: local::/pkgs/testthat# GitoriousRemotes: gitorious::r-mpc-package/r-mpc-package