MyNixOS website logo
Description

List Functions in Documentation.

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.

doclisting

R-CMD-check Codecov testcoverage

doclisting automatically generates itemized lists of methods for a generic function, suitable for inclusion in roxygen2 documentation. Each method links to its help topic, and methods from other packages are clearly labeled.

Installation

You can install the released version from CRAN:

install.packages("doclisting")

Or the development version from GitHub:

pak::pak("hadley/doclisting")

Usage

methods_list() and methods_inline() generate Rd markup listing all methods for a generic:

cat(doclisting::methods_list("mean"))
#> \itemize{
#>   \item \code{\link[=Dates]{Date}}
#>   \item \code{default}
#>   \item \code{\link[=difftime]{difftime}}
#>   \item \code{\link[=DateTimeClasses]{POSIXct}}
#>   \item \code{\link[=DateTimeClasses]{POSIXlt}}
#>   \item \code{quosure} (\pkg{rlang})
#> }
cat(doclisting::methods_inline("mean"))
#> \code{\link[=Dates]{Date}}, \code{default}, \code{\link[=difftime]{difftime}},
#> \code{\link[=DateTimeClasses]{POSIXct}},
#> \code{\link[=DateTimeClasses]{POSIXlt}}, \code{quosure} (\pkg{rlang})

You can use it in roxygen2 documentation in two ways:

  • Compute methods when the package is documented (i.e. at devtools::document() time), use inline R code in your roxygen comment:

    #' @description
    #' `r doclisting::methods_list("my_generic")`
    

    You’ll need to add doclisting to Suggests.

  • Compute methods when documentation is rendered (i.e. at ? time), use an Rd code block:

    #' @description
    #' `Rd doclisting::methods_list("my_generic")`
    

    You’ll need to add doclisting to Imports and add dummy call to methods_list() to eliminate the R CMD check note:

    ignore_unused_imports <- function() {
        doclisting::methods_list
    }
    
Metadata

Version

0.1.0

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows