get_sig_text: Produce the textual form of the signatures of available...

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/signature.R

Description

Produce the textual form of the signatures of available methods for an S4 generic function.

Usage

1
get_sig_text(rdo, package = NULL)

Arguments

rdo

an Rd object.

package

if of class "character", give only methods defined by package, otherwise give all methods.

Details

Signatures are found using function findMethodSignatures from package "methods".

Value

A character vector with one element for each method.

Note

todo: It would be better to call promptMethods() to get the signatures but in version R-2.13.x I had trouble with argument ‘where’ (could not figure out how to use it to restrict to functions from a package; also, promptMethods() seemed to call the deprecated function getMethods()). Check how these things stand in current versions of R, there may be no problem any more (checked, in 2.14-0 it is the same).

Author(s)

Georgi N. Boshnakov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require("stats4") # to ensure the presence of S4 methods from
                  # at least one package other than "methods"

fn <- help("show-methods", package = "methods")
rdo <- utils:::.getHelpFile(fn)

# this will find all methods for "show" in currently loaded packages
get_sig_text(rdo)

# this will select only the ones from package "stats4"
get_sig_text(rdo, package = "stats4")

# this is also fine but need to choose
# the appropriate element of "fn" if length(fn) > 1
fn <- help("show-methods")


# this finds nothing
fn <- help("logLik-methods", package = "methods")

# this does
fn <- help("logLik-methods", package = "stats4")
rdo <- utils:::.getHelpFile(fn)

get_sig_text(rdo)
get_sig_text(rdo, package = "stats4")

Rdpack documentation built on May 24, 2018, 5:04 p.m.