scan_deps {pkgdepends}R Documentation

Scan R code for dependent packages

Description

Scan all R files of a project or directory for packages used within them. It parses R code to find library(package), package::func(), and similar calls that imply package dependencies. See details below.

Usage

scan_deps(path = NULL, root = NULL)

Arguments

path

Files and/or directories to scan. Defaults to the current project, detected by finding the first parent directory of the current working directory, that contains a file or directory called DESCRIPTION, .git, .Rproj.user, renv.lock, or renv. (Note that this is different from renv::dependencies(), which only scans the current working directory by default!)

If path is not NULL, then only the specified files and directories are scanned, the directories recursively. In this case the root argument is used as the project root, to find .gitignore and .renvignore files. All entries of path must be within the root, the project root.

root

The root directory of the project. It is used to find the .gitignore and .renvignore files. By default the same algorithm is used to detect this as for path. If path is specified and it is not within the detected or specified root, scan_path() throws an error.

Value

Data frame with columns:

Note the data frame may contain the same package multiple times, if it was detected multiple times, e.g. multiple library() calls load the same package.

Detected dependencies

scan_deps() detects package dependencies from these R expressions:

Dependency types

scan_deps() classifies package dependencies into three groups, based on which files they were found:


[Package pkgdepends version 0.9.0 Index]