List the external R packages required to be installed

get_all_external_dependencies(
  dep_structure,
  available_packages = as.data.frame(utils::available.packages()),
  install_direction = "upstream",
  package_list = NULL,
  from_internal_dependencies = c("Depends", "Imports", "LinkingTo", "Suggests"),
  from_external_dependencies = c("Depends", "Imports", "LinkingTo")
)

Arguments

dep_structure

(dependency_structure) output of function dependency_table; uses dep_structure$table to infer the packages to apply action to and infer installation order; uses dep_structure$deps to infer upstream dependencies

available_packages

(data.frame) A dataframe of the format given by as.data.frame(utils::available.packages). It is unlikely this default needs to be changed; however you need to ensure the options("repos") contains the urls of all expected repos (e.g. Bioconductor).

install_direction

"upstream", "downstream" or "all"; which packages to install (according to dependency structure). By default this is only "upstream"

package_list

(character) If not NULL, an additional filter, only packages on this list will be considered and their dependencies installed if needed (advanced usage only).

from_internal_dependencies

Vector chosen from c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances") which fields of the DESCRIPTION file of the internal packages should be included. Default: c("Depends", "Imports", "LinkingTo", "Suggests")

from_external_dependencies

Vector chosen from c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances") which fields of the DESCRIPTION file of the internal packages should be included. Default: c("Depends", "Imports", "LinkingTo")

Value

A vector of 'external' R packages required to install the selected 'internal' packages, ordered by install order (unless from_external_dependencies

does not include "Depends", "Imports" and "LinkingTo"). The core R packages (e.g. methods, utils) are not included. The output can be used with remotes::system_requirements

to extract the system requirements needed for your packages, see example below.

Examples

if (FALSE) {
x <- dependency_table("openpharma/stageddeps.electricity",
  project_type = "repo@host", feature = "main"
)

# get external package dependencies
ex_deps <- get_all_external_dependencies(x)
print(ex_deps)

# get system dependencies (in this case there are none)
unique(unlist(lapply(ex_deps,
  function(pkg, ...) {
    remotes::system_requirements(package = pkg, ...)
  },
  os = "ubuntu",
  os_release = "20.04"
)))
}