desc: Read a DESCRIPTION file

View source: R/description.R

descR Documentation

Read a DESCRIPTION file

Description

This is a convenience wrapper for description$new(). Very often you want to read an existing DESCRIPTION file, and to do this you can just supply the path to the file or its directory to desc().

Usage

desc(cmd = NULL, file = NULL, text = NULL, package = NULL)

Arguments

cmd

A command to create a description from scratch. Currently only "!new" is implemented. If it does not start with an exclamation mark, it will be interpreted as the file argument.

file

Name of the DESCRIPTION file to load. If all of cmd, file and text are NULL (the default), then the DESCRIPTION file in the current working directory is used. The file can also be an R package (source, or binary), in which case the DESCRIPTION file is extracted from it, but note that in this case ⁠$write()⁠ cannot write the file back in the package archive.

text

A character scalar containing the full DESCRIPTION. Character vectors are collapsed into a character scalar, with newline as the separator.

package

If not NULL, then the name of an installed package and the DESCRIPTION file of this package will be loaded.

Examples

desc(package = "desc")
DESCRIPTION <- system.file("DESCRIPTION", package = "desc")
desc(DESCRIPTION)

r-lib/desc documentation built on Aug. 29, 2024, 5:23 p.m.