add_dependencies: Add dependencies in DESCRIPTION

View source: R/add_dependencies.R

add_dependenciesR Documentation

Add dependencies in DESCRIPTION

Description

This function detects external dependencies used in ⁠R/⁠, NAMESPACE, and ⁠@examples⁠ sections of roxygen2 headers and automatically adds these dependencies in the Imports section of the DESCRIPTION file.

In the NAMESPACE this function detects dependencies mentioned as import(pkg) and importFrom(pkg,fun).

In the ⁠R/⁠ folder it detects functions called as pkg::fun() in the code of each R files. In ⁠@examples⁠ sections it also detects packages attached by library() or require().

The ⁠vignettes/⁠ folder is also inspected and detected dependencies (pkg::fun(), library() or require()) are added to the Suggests field of the DESCRIPTION file (in addition to the packages knitr and rmarkdown).

If the project is a research compendium user can also inspect additional folder(s) with the argument compendium to add dependencies to the Imports section of the DESCRIPTION file. The detection process is the same as the one used for ⁠vignettes/⁠.

The ⁠tests/⁠ folder is also inspected and detected dependencies (pkg::fun(), library() or require()) are added to the Suggests field of the DESCRIPTION file (in addition to the package testthat).

Usage

add_dependencies(compendium = NULL)

Arguments

compendium

A character of length 1. The name of the folder to recursively detect dependencies to be added to the Imports field of DESCRIPTION file. It can be 'analysis/' (if additional folders, i.e. ⁠data/⁠, ⁠outputs/⁠, ⁠figures/⁠, etc. have been created in this folder), '.' (if folders ⁠data/⁠, ⁠outputs/⁠, ⁠figures/⁠, etc. have been created at the root of the project), etc. See new_compendium() for further information.

Default is compendium = NULL (i.e. no additional folder are inspected but ⁠R/⁠, NAMESPACE, ⁠vignettes/⁠, and ⁠tests/⁠ are still inspected).

Value

No return value.

See Also

Other development functions: add_github_actions_check(), add_github_actions_citation(), add_github_actions_codecov(), add_github_actions_document(), add_github_actions_pkgdown(), add_github_actions_render(), add_r_depend(), add_to_buildignore(), add_to_gitignore()

Examples

## Not run: 
add_dependencies()

## End(Not run)

rcompendium documentation built on Oct. 26, 2023, 5:08 p.m.