This is intended to replace package_dependencies or pkgDep in the miniCRAN package, but with modifications for speed. It will first check local package directories in libPath, and it if the function cannot find the packages there, then it will use package_dependencies.

pkgDep(packages, libPath, recursive = TRUE, depends = TRUE,
  imports = TRUE, suggests = FALSE, linkingTo = TRUE,
  repos = getOption("repos"))

Arguments

packages

a character vector of package names.

libPath

The library path where all packages should be installed, and looked for to load (i.e., call library)

recursive

Logical. Should dependencies of dependencies be searched, recursively. NOTE Dependencies of suggests will not be recursive. Default TRUE.

depends

Logical. Include packages listed in "Depends". Default TRUE.

imports

Logical. Include packages listed in "Imports". Default TRUE.

suggests

Logical. Include packages listed in "Suggests". Default FALSE.

linkingTo

Logical. Include packages listed in "LinkingTo". Default TRUE.

repos

The remote repository (e.g., a CRAN mirror), passed to either install.packages, install_github or installVersions.

Note

package_dependencies and pkgDep will differ under the following circumstances:

  1. GitHub packages are not detected using tools::package_dependencies;

  2. tools::package_dependencies does not detect the dependencies of base packages among themselves, e.g., methods depends on stats and graphics.

Examples

pkgDep("crayon")
#> $crayon #> [1] "grDevices" "methods" "utils" "stats" "graphics" #>