setGroupGeneric | R Documentation |
The setGroupGeneric
function behaves like setGeneric
except that it constructs a group generic function, differing in two
ways from an ordinary generic function. First, this function cannot
be called directly, and the body of the function created will contain
a stop call with this information. Second, the group generic function
contains information about the known members of the group, used to
keep the members up to date when the group definition changes, through
changes in the search list or direct specification of methods, etc.
All members of the group must have the identical argument list.
setGroupGeneric(name, def= , group=list(), valueClass=character(), knownMembers=list(), package= , where= )
name |
the character string name of the generic function. |
def |
A function object. There isn't likely to be an existing nongeneric of this name, so some function needs to be supplied. Any known member or other function with the same argument list will do, because the group generic cannot be called directly. |
group, valueClass |
arguments to pass to
|
knownMembers |
the names of functions that are known to be members of this group. This information is used to reset cached definitions of the member generics when information about the group generic is changed. |
package, where |
passed to |
The setGroupGeneric
function exists for its side effect: saving the
generic function to allow methods to be specified later. It returns
name
.
Chambers, John M. (2016) Extending R Chapman & Hall
Methods_Details
and the links there for a general discussion,
dotsMethods
for methods that dispatch on
...
, and setMethod
for method definitions.
## Not run: ## the definition of the "Logic" group generic in the methods package setGroupGeneric("Logic", function(e1, e2) NULL, knownMembers = c("&", "|")) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.