Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

method_from_call

Given a function class, find correspoding S4 method


Description

Given a function class, find correspoding S4 method

Usage

method_from_call(call, env = parent.frame())

Arguments

call

unquoted function call

env

environment in which to look for function definition

Examples

library(stats4)

# From example(mle)
y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8)
nLL <- function(lambda) -sum(dpois(y, lambda, log = TRUE))
fit <- mle(nLL, start = list(lambda = 5), nobs = length(y))

method_from_call(summary(fit))
method_from_call(coef(fit))
method_from_call(length(fit))

pryr

Tools for Computing on the Language

v0.1.4
GPL-2
Authors
Hadley Wickham [aut, cre], R Core team [ctb] (Some code extracted from base R)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.