scrapeDependencies: Scrape dependencies

View source: R/scrapeDependencies.R

scrapeDependenciesR Documentation

Scrape dependencies

Description

Scrape Rmarkdown reports in the book for all required dependencies.

Usage

scrapeDependencies(dir, recursive = TRUE, pattern = "\\.Rmd$")

Arguments

dir

String containing the path to the directory containing Rmarkdown reports. This is searched recursively for all files ending in ".Rmd".

recursive, pattern

Further arguments to pass to list.files when searching for Rmarkdown reports.

Details

The output of this should be added to the Suggests field of the book's DESCRIPTION, to make it easier to simply install all of its required dependencies.

Note that dependencies in inline code sections are not detected, so these should be explicitly mentioned in a standalone code chunk to be captured.

Value

Character vector of required packages.

Author(s)

Aaron Lun

Examples

tmp <- tempfile(fileext=".Rmd")
write(file=tmp, "```{r}
A::a()
```

```{r}
library(B)
require(C)
```")

scrapeDependencies(tempdir())


LTLA/rebook documentation built on June 5, 2023, 6:24 p.m.