Learn R Programming

attachment (version 0.3.1)

create_dependencies_file: Create a dependencies.R in the inst folder

Description

Create a dependencies.R in the inst folder

Usage

create_dependencies_file(
  path = "DESCRIPTION",
  field = c("Depends", "Imports"),
  to = "inst/dependencies.R",
  open_file = TRUE,
  ignore_base = TRUE
)

Value

Used for side effect. Shows a message with installation instructions and creates a R file containing these instructions.

Arguments

path

path to the DESCRIPTION file

field

DESCRIPTION field to parse, "Import" and "Depends" by default. Can add "Suggests"

to

path to dependencies.R. "inst/dependencies.R" by default

open_file

Logical. Open the file created in an editor

ignore_base

Logical. Whether to ignore package coming with base, as they cannot be installed

Examples

Run this code
tmpdir <- tempfile(pattern = "depsfile")
dir.create(tmpdir)
file.copy(system.file("dummypackage",package = "attachment"), tmpdir,
 recursive = TRUE)
dummypackage <- file.path(tmpdir, "dummypackage")
# browseURL(dummypackage)

create_dependencies_file(path = file.path(dummypackage,"DESCRIPTION"),
to = file.path(dummypackage, "inst/dependencies.R"),
open_file = FALSE)

# Clean temp files after this example
unlink(tmpdir, recursive = TRUE)

Run the code above in your browser using DataLab