funDispatch | R Documentation |
find dispatched functions for an object
funDispatch(f, object, envir = topenv(parent.frame()))
f |
function name. |
object |
the object that the function f is processing |
envir |
the working environment |
a list of two elements: S3 and S4, which list all methods that
can be dispatched for S3 and S4 objects, respectively. NULL in S3
element means no method is found for this function by treating the "object"
as an S3 object. And similar to NULL in S4 element. If both S3 and
S4 elements are NULL, the function f
appears not to be either
S3 generic or S4 generic, and the original function without dispatching
is applied. The function f can be an alias of another generic function,
the attribute "name" of the result is the very original generic function
name.
## Not run:
funDispatch(f = "print", object = "asdf") #ls.default
funDispatch("print", object = ~ a + b) #ls.formula
funDispatch("lm", object = ~ a + b) #lm itself
funDispatch("show", object = "asdf") # S4 "ANY"
funDispatch(show, object = "asdf") # S4 "ANY"
x = show
funDispatch(x, object = "asdf") # S4 "ANY"
funDispatch("x", object = "asdf") # S4 "ANY"
y = "show"
funDispatch(y, object = "asdf") # S4 "ANY"
funDispatch("y", object = "asdf") # Not found
funDispatch("ls", object = .GlobalEnv) # itself
x = ls
y = "ls"
funDispatch(x, object = .GlobalEnv) # itself
funDispatch(y, object = .GlobalEnv) # itself
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.