deps: Dependencies of a Workflow

View source: R/deps.R

depsR Documentation

Dependencies of a Workflow

Description

Search R scripts for packages that are required.

Usage

deps(path = ".", base = FALSE, installed = TRUE, available = TRUE,
  list = FALSE)

Arguments

path

a directory or file containing R scripts.

base

whether to include base packages in the output.

installed

whether to include installed packages in the output.

available

whether to include available packages in the output.

list

whether to return packages in list format, split by script.

Details

The files analyzed are those with the file extensions .R, .r, .Rmd, and .rmd.

Value

Names of packages as a vector, or in list format if list=TRUE. If no dependencies are found, the return value is NULL.

Note

Package names are matched based on four patterns:

library(*)
require(*)
*::object
*:::object

The search algorithm may return false-positive dependencies if these patterns occur inside if-clauses, strings, comments, etc.

See Also

installed.packages, available.packages.

pdeps shows the dependencies of a package.

TAF-package gives an overview of the package.

Examples

## Not run: 
dir <- system.file(package="MASS", "scripts")
script <- system.file(package="MASS", "scripts/ch08.R")

deps(script)                   # dependencies
deps(script, base=TRUE)        # including base packages
deps(script, installed=FALSE)  # not (yet) installed

deps(dir)
deps(dir, list=TRUE)

deps(dir, available=FALSE)  # dependencies that might be unavailable

## End(Not run)


ices-tools-prod/TAF documentation built on April 17, 2025, 2:02 p.m.