Package 'doclisting'

Title: List Functions in Documentation
Description: Generate 'Rd' markup to list methods for a generic function. Makes it easier to document S3, S4, and S7 generics by automatically finding and linking to method documentation.
Authors: Hadley Wickham [aut, cre] (ORCID: <https://orcid.org/0000-0003-4757-117X>), Posit Software, PBC [cph, fnd] (ROR: <https://ror.org/03wc8by49>)
Maintainer: Hadley Wickham <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0.9000
Built: 2026-05-22 09:16:25 UTC
Source: https://github.com/r-lib/doclisting

Help Index


List methods for a generic

Description

Generate Rd markup to list methods for a generic function. methods_list() generates a bulleted list and methods_inline() produces a comma-separated list, suitable for inline use.

You can use them in roxygen2 documentation in two ways:

  • Compute methods when package is documented: `r doclisting::methods_list("generic")` You'll need to include doclisting in Suggests.

  • Compute methods when documentation is rendered: `Rd doclisting::methods_list("generic")` You'll need to include doclisting in Imports.

Methods from the same package as the generic are linked without a package qualifier; methods from other packages include the package name.

Usage

methods_list(x, package = NULL)

methods_inline(x, package = NULL)

Arguments

x

Name of the generic function (a string).

package

Package that defines the generic. Should only be needed in unusual cases as the default will attempt to determine it automatically.

Value

A string containing Rd markup, or "" if no methods are found.

Examples

cat(methods_list("mean"))
cat(methods_inline("mean"))