S4formals: Give the formal arguments of an S4 method

View source: R/signature.R

S4formalsR Documentation

Give the formal arguments of an S4 method

Description

Give the formal arguments of an S4 method.

Usage

S4formals(fun, ...)

Arguments

fun

name of an S4 generic, a string, or the method, see Details.

...

further arguments to be passed to getMethod, see Details.

Details

S4formals gives the formal arguments of the requested method. If fun is not of class methodDefinition, it calls getMethods, passing on all arguments.

Typically, fun is the name of a generic function and the second argument is the signature of the method as a character vector. Alternatively, fun may be the method itself (e.g. obtained previously from getMethod) and in that case the ⁠"\dots"⁠ arguments are ignored. See getMethod for full details and other acceptable arguments.

Value

a pairlist, like formals

Note

Arguments of a method after those used for dispatch may be different from the arguments of the generic. The latter may simply have a ⁠"\dots"⁠ argument there.

todo: there should be a similar function in the "methods" package, or at least use a documented feature to extract it.

Author(s)

Georgi N. Boshnakov

Examples

require(stats4) # makes plot() S4 generic

S4formals("plot", c(x = "profile.mle", y = "missing"))

m1 <- getMethod("plot", c(x = "profile.mle", y = "missing"))
S4formals(m1)

GeoBosh/Rdpack documentation built on Nov. 11, 2023, 5:22 p.m.