deps: List Dependencies

Description Usage Arguments Value Note See Also Examples

View source: R/deps.R

Description

Search R scripts for packages that are required.

Usage

1
2
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.

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:

1
2
3
4
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.

TAF-package gives an overview of the package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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)

TAF documentation built on April 7, 2021, 5:06 p.m.