Group generic methods can be defined for four pre-specified groups of functions, Math, Ops, Summary and Complex. (There are no objects of these names in base R, but there are in the methods package.) A method defined for an individual member of the group takes precedence over a method defined for the group as a whole.
## S3 methods for group generics have prototypes:
<code>Math(x, \dots)</code>
<code>Ops(e1, e2)</code>
<code>Complex(z)</code>
<code>Summary(\dots, na.rm = FALSE)</code>
| Parameter | Description |
|---|---|
x, z, e1, e2 |
objects. |
… |
further arguments passed to methods. |
na.rm |
logical: should missing values be removed? |
# NOT RUN {
require(utils)
d.fr <- data.frame(x = 1:9, y = stats::rnorm(9))
class(1 + d.fr) == "data.frame" ##-- add to d.f. ...
methods("Math")
methods("Ops")
methods("Summary")
methods("Complex") # none in base R
# }