Skip to content

Retrieves the parsed Rd object documenting topic in package. For installed packages the topic is fetched lazily from the package's help database (no parsing needed); for source and in-development packages the Rd file is parsed with tools::parse_Rd(), with the package's Rd macros loaded. Results are cached per topic, so repeated access (e.g. roxygen2 inheriting several fields from one topic) only pays once.

Usage

topic_rd(topic, package)

Arguments

topic

A single string.

package

A package name, or a path to the source directory of a package.

Value

An Rd object: a recursive structure of class "Rd", as returned by tools::parse_Rd(). Returns NULL if the package or topic doesn't exist; use topic_exists() first if you need to distinguish that from other problems.

Examples

rd <- topic_rd("rnorm", "stats")
class(rd)
#> [1] "Rd"