Learn R Programming

suggests (version 0.1.0)

find_deps: List places where dependencies are used

Description

A quick-and-dirty diagnostic tool to find dependency usage within top-level expressions (e.g. declared functions) in R scripts within a development package.

Usage

find_deps(path = ".", threshold = NULL)

Value

A data frame, with one row per distinct top-level expression where a package is used. Packages used in the fewest places are listed first.

Arguments

path

Path to the base directory of a package.

threshold

Only report on dependencies used in fewer than this many top-level expressions.

Details

This might be useful for package developers hoping to use need() in their package, and looking for good candidates for dependencies which could be moved from Imports to Suggests in the DESCRIPTION file.

Dependencies are searched for in two ways:

  • import() and importFrom() statements in the package's NAMESPACE file, such as those created by @import and @importFrom tags if creating package documentation with roxygen2

  • Functions called by using :: or ::: to access a dependency's namespace directly

This approach isn't perfect, but it should capture most dependency uses.

Examples

Run this code
  find_deps(system.file("demopkg", package = "suggests"))

Run the code above in your browser using DataLab