Learn R Programming

polished (version 0.4.0)

get_package_deps: Create a list of R Package Dependencies

Description

Given a path to a directory this function will scan all .R and .Rmd files for any used R Packages along with their CRAN versions or GitHub references.

Usage

get_package_deps(app_dir = ".", verbose = TRUE)

Arguments

app_dir

path to a directory containing R scripts or RMarkdown files. Defaults to current working directory if left blank.

verbose

logical - defaults to TRUE. Will provide feedback to detected or invalid R packages.

Value

a list of package dependencies

Details

Currently, detections are made via automagic::parse_packages() which supports the following calls within the code: library(), require(), and prefixed :: calls to functions.

Once an initial vector of package detections is built, it is further processed by validating that each detection is indeed a valid CRAN or public GitHub package and can be installed.

See Also

automagic::parse_packages()

Examples

Run this code
# NOT RUN {
library(polished)
dir <- system.file("examples", "polished_example_01", package = "polished")
pkg_deps <- polished:::get_package_deps(dir)

# }

Run the code above in your browser using DataLab