add_dependencies: Add dependencies in DESCRIPTION

Description Usage Arguments Value See Also Examples

View source: R/add_dependencies.R

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

1
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

None

See Also

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

Examples

1
2
3
4
## Not run: 
add_dependencies()

## End(Not run)

rcompendium documentation built on March 24, 2021, 5:06 p.m.