Downloading non-CRAN dependencies from Github

I want to include the package learnrhash in my custom package. I've referred to the vignette on adding Remotes: to the Description file. However, whenever the user is prompted to download "learnrhash" because it is included in Imports:, R attempts to install from CRAN instead of from the Github repository.

Does anyone know what is going wrong? Here is the relevant section in Description:

Imports:
    learnrhash
Remotes:
    rundel/learnrhash

Does the user use remotes to install the package, e.g. remotes::install_github()?

If your users are coworkers, consider setting up a package repository. As a bonus, it'd also let you share internally developed packages. There are a couple ways to do this, depending on what you need:

If you don't have a collaborative relationship with your users, then I think it's better to let the error remain. Let users know to install learnrhash before your package in the README. People should explicitly (i.e., consent to) download packages from sources other than CRAN. I would be horrified if installing a package downloaded and ran code from a source I don't trust without my consent.

2 Likes

Yes, they do. The line to install should be remotes::install_github("rundel/learnrhash").

1 Like

My question was, how do they install your package? If they install it from a repository e.g. on GitHub, with the remotes package, or even from a copy of the source with remotes::install_local(), then what you wrote in DESCRIPTION is enough for installing dev learnrhash.

@nwerth makes very good points though about explicit instructions!

1 Like