Access the data inside an S4 method definition

methodFunction(f, signature, package)

methodFormals(f, signature, package)

hasLocal(definition)

extractLocal(definition)

## Arguments

f a generic function or the character-string name of one. the signature of classes to match to the arguments of f. See the details below. character(1). Package name. A function definition, which will become the method called when the arguments in a call to f match the classes in signature, directly or through inheritance. The definition must be a function with the same formal arguments as the generic; however, setMethod() will handle methods that add arguments, if … is a formal argument to the generic. See the Details section.

## Value

• methodFormals: list. Extract the sealed formal arguments.

• methodFunction: function. Extract the sealed function.

• Modified version of John Chambers' code.

• help(topic = "MethodDefinition-class", package = "methods").

• methods::selectMethod().

• methods::setMethod().

## Examples

## Function ====
x <- methodFunction(
f = "as.data.frame",
signature = "ANY",
package = "S4Vectors"
)
class(x)#> [1] "function"formals(x)#> $x #> #> #>$row.names
#> NULL
#>
#> $optional #> [1] FALSE #> #>$...
#>
#>
## Formals ====
x <- methodFormals(
f = "as.data.frame",
signature = "ANY",
package = "S4Vectors"
)
class(x)#> [1] "pairlist"print(x)#> $x #> #> #>$row.names
#> NULL
#>
#> $optional #> [1] FALSE #> #>$...
#>
#>