Learn R Programming

deps (version 0.4.0)

create: Create a Dependencies JSON File

Description

Discover dependencies and write a dependencies.json file.

Usage

create(
  dir = getwd(),
  file = "dependencies.json",
  output = dir,
  installed = c("base", "recommended"),
  overwrite = TRUE,
  ask = TRUE
)

Value

Invisibly returns the list of file names that were created. The side effect is a JSON (and possibly a text for system requirements) file written to the hard drive. The function fails when there are no R related files in dir.

Arguments

dir

Path to the directory where the files to be scanned are located.

file

The name of the file to be save, default is "dependencies.json".

output

Path to the directory where JSON file should be written to.

installed

The priority argument for installed.packages() for packages to be excluded.

overwrite

Logical, should the file in the output directory be overwritten if exists?

ask

Logical, asking confirmation before writing the dependencies.json file.

Examples

Run this code
dir <- system.file("examples/01-basic", package = "deps")
out <- tempdir()
create(dir, output = out, ask = interactive())
cat(readLines(file.path(out, "dependencies.json")), sep = "\n")
unlink(file.path(out, "dependencies.json"))

Run the code above in your browser using DataLab