methods_list: List methods for a generic

View source: R/docs.R

methods_listR Documentation

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"))

doclisting documentation built on April 15, 2026, 5:07 p.m.