Prevent automatic installation of packages referred to in Remotes in DESCRIPTION file for R packages

175 Views Asked by At

We have an organisational GitLab server where we store some internal packages. For packageA stored on GitLab to depend on another package (packageB) stored on GitLab we have the equivalent lines in packageA's DESCRIPTION file:

Imports:
    packageB
Remotes: url::https://gitlab.orgname.uk/packages/packageB/-/archive/master/packageB-master.zip

We want to install the uninstalled dependencies, but not install the the dependencies that are already installed (or ask us before installing them at least).

We install the package from GitLab using remotes::install_git(). This seems to install packageB even when already we have the latest version installed. Is there a way around this?

1

There are 1 best solutions below

3
JBGruber On

Usually that would look something like this:

remotes::install_gitlab("packages/packageB", dependencies = FALSE)

From the help file (?remotes::install_gitlab):

dependencies:

Which dependencies do you want to check? Can be a character vector (selecting from "Depends", "Imports", "LinkingTo", "Suggests", or "Enhances"), or a logical vector.

TRUE is shorthand for "Depends", "Imports", "LinkingTo" and "Suggests". NA is shorthand for "Depends", "Imports" and "LinkingTo" and is the default. FALSE is shorthand for no dependencies (i.e. just check this package, not its dependencies).

What you show above hints that you might use remotes::install_url() instead. But the dependencies argument is the same here.