add_dependencies: Add Dependencies in DESCRIPTION File

Description Usage Arguments Details Examples

View source: R/add_dependencies.R

Description

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

Usage

1
add_dependencies(path = ".", import = NULL, suggest = "vignettes")

Arguments

path

the path to the package/research compendium (must have a DESCRIPTION file) in which dependencies are recursively detected.

import

(optional) the name of the folder to recursively detect dependencies to be added in the Imports field of DESCRIPTION file. Default is import = NULL (but R/, NAMESPACE, and @examples are still inspected).

suggest

the name of the folder to recursively detect dependencies to be added in the Suggests field of DESCRIPTION file. Default is suggest = "vignettes".

Details

In the NAMESPACE file it detects dependencies mentionned 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 section it also detects packages attached using library(pkg) or require(pkg).

The folder vignettes/ is also inspected and detected dependencies (pkg::fun(), library(pkg) or require(pkg)) are added in the section Suggests of the DESCRIPTION file.

If the project is a research compendium user can also inspect one additional folder (i.e. analysis/) with the argument import to detected dependencies to be added in the section Imports of the DESCRIPTION file. The detection process is the same as the one used for vignettes/.

Examples

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

## End(Not run)

ahasverus/rtoolbox documentation built on Feb. 22, 2021, 3:59 a.m.