funWhich | R Documentation |
get the dispatched S3 or S4 method of a function
funWhich(f, object, returnAll = FALSE, envir = topenv(parent.frame()))
f |
function or function name. |
object |
the object that the function f is processing. |
returnAll |
Whether all possibly existed |
envir |
the working environment. |
either a list of length 3, containing origin
al function,
S3
method and S4
method, or a function object.
## Not run:
# print from base package is a S3 generic
detachPackages("Matrix")
funWhich(print, "asdfasdfasd", TRUE)
funWhich(print, "asdfasdfasd")
library(Matrix) # print becomes a S4 standardGeneric
funWhich(print, "asdfasdfasd", TRUE)
funWhich(print, "asdfasdfasd") # if S3 and S4 both exists, then S3 is shown.
fit <- lm(Sepal.Length ~ Petal.Length + Petal.Width + Species,
data = datasets::iris)
resFun = funWhich(print, fit)
resFun
resFun(fit)
stats:::print.lm(fit)
funWhich(show, object = ~ a + b, T)
funWhich(show, object = ~ a + b)
funWhich(showDefault, object = ~ a + b)
x = show
funWhich(x, object = ~ a + b, T)
funWhich(x, object = ~ a + b)
xw = funWhich("x", object = ~ a + b)
xw
attributes(xw)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.