
102 R Programming for Bioinformatics
generic function and it also establishes a default method that will be used if
no function with matching signature is found.
The syntax is quite straightforward. The def argument is a function, each
named argument can be dispatched on, and the . . . argument should be used
if other arguments to the generic will be permitted. These arguments cannot
b e dispatched on, however. So in the code below, the generic function has two
named arguments, object and x, and methods can be defined that indicate
different signatures for these two arguments.
> setGeneric("foo", function(object, x) standardGeneric("foo"))
[1] "foo"
>