promptPackage {utils}R Documentation

Generate a Shell for Documentation of a Package

Description

Generates a prototype of a package overview help page using Rd macros that dynamically extract information from package metadata when building the package.

Usage

promptPackage(package, lib.loc = NULL, filename = NULL,
              name = NULL, final = FALSE)

Arguments

package

a character string with the name of the package to be documented.

lib.loc

ignored.

filename

usually, a connection or a character string giving the name of the file to which the documentation shell should be written. The default corresponds to a file whose name is name followed by ".Rd". Can also be NA (see below).

name

a character string specifying the name of the help topic; defaults to "pkgname-package", which is the required ⁠\alias⁠ for the overview help page.

final

a logical value indicating whether to attempt to create a usable version of the help topic, rather than just a shell.

Details

Unless filename is NA, a documentation shell for package is written to the file specified by filename, and a message about this is given.

If filename is NA, a list-style representation of the documentation shell is created and returned. Writing the shell to a file amounts to cat(unlist(x), file = filename, sep = "\n"), where x is the list-style representation.

If final is TRUE, the generated documentation will not include the place-holder slots for manual editing, it will be usable as-is. In most cases a manually edited file is preferable (but final = TRUE is certainly less work).

Value

If filename is NA, a list-style representation of the documentation shell. Otherwise, the name of the file written to is returned invisibly.

See Also

prompt, package.skeleton

Examples

filename <- tempfile()
promptPackage("utils", filename = filename)
file.show(filename)
unlink(filename)

[Package utils version 4.4.1 Index]