Learn R Programming

TAF (version 4.2.0)

deps: List Dependencies

Description

Search R scripts for packages that are required.

Usage

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

Value

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

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.

See Also

installed.packages, available.packages.

TAF-package gives an overview of the package.

Examples

Run this code
if (FALSE) {
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
}

Run the code above in your browser using DataLab