| Line 57... |
Line 57... |
| 57 |
for a group generic is loaded, the methods defined become methods
|
57 |
for a group generic is loaded, the methods defined become methods
|
| 58 |
for the members of the group, but only if no method has been
|
58 |
for the members of the group, but only if no method has been
|
| 59 |
specified directly for the member function for the same signature.
|
59 |
specified directly for the member function for the same signature.
|
| 60 |
The effect is that group generic definitions are selected before
|
60 |
The effect is that group generic definitions are selected before
|
| 61 |
inherited methods but after directly specified methods. For more on
|
61 |
inherited methods but after directly specified methods. For more on
|
| 62 |
method selection, see \code{\link{Methods}}.
|
62 |
method selection, see \code{\link{Methods_Details}}.
|
| 63 |
|
63 |
|
| 64 |
There are also
|
64 |
There are also
|
| 65 |
S3 groups \code{Math}, \code{Ops}, \code{Summary} and
|
65 |
S3 groups \code{Math}, \code{Ops}, \code{Summary} and
|
| 66 |
\code{Complex}, see \code{?\link{S3groupGeneric}},
|
66 |
\code{Complex}, see \code{?\link{S3groupGeneric}},
|
| 67 |
with no corresponding \R objects, but these are irrelevant for S4
|
67 |
with no corresponding \R objects, but these are irrelevant for S4
|
| Line 103... |
Line 103... |
| 103 |
All the functions in these groups (other than the group generics
|
103 |
All the functions in these groups (other than the group generics
|
| 104 |
themselves) are basic functions in \R. They are not by default S4 generic
|
104 |
themselves) are basic functions in \R. They are not by default S4 generic
|
| 105 |
functions, and many of them are defined as primitives. However, you can still define
|
105 |
functions, and many of them are defined as primitives. However, you can still define
|
| 106 |
formal methods for them, both individually and via the group generics. It all works more or less as you
|
106 |
formal methods for them, both individually and via the group generics. It all works more or less as you
|
| 107 |
might expect, admittedly via a bit of trickery in the background.
|
107 |
might expect, admittedly via a bit of trickery in the background.
|
| 108 |
See \link{Methods} for details.
|
108 |
See \link{Methods_Details} for details.
|
| 109 |
|
109 |
|
| 110 |
Note that two members of the \code{Math} group, \code{\link{log}} and
|
110 |
Note that two members of the \code{Math} group, \code{\link{log}} and
|
| 111 |
\code{\link{trunc}}, have \dots as an extra formal argument.
|
111 |
\code{\link{trunc}}, have \dots as an extra formal argument.
|
| 112 |
Since methods for \code{Math} will have only one formal argument,
|
112 |
Since methods for \code{Math} will have only one formal argument,
|
| 113 |
you must set a specific method for these functions in order to call
|
113 |
you must set a specific method for these functions in order to call
|
| 114 |
them with the extra argument(s).
|
114 |
them with the extra argument(s).
|
| 115 |
|
115 |
|
| 116 |
For further details about group generic functions see section 10.5 of
|
116 |
For further details about group generic functions see section 10.5 of
|
| 117 |
\emph{Software for Data Analysis}.
|
117 |
the second reference.
|
| 118 |
|
118 |
|
| 119 |
}
|
119 |
}
|
| 120 |
\references{
|
120 |
\references{
|
| - |
|
121 |
Chambers, John M. (2016)
|
| - |
|
122 |
\emph{Extending R},
|
| - |
|
123 |
Chapman & Hall.
|
| - |
|
124 |
(Chapters 9 and 10.)
|
| - |
|
125 |
|
| - |
|
126 |
|
| 121 |
Chambers, John M. (2008)
|
127 |
Chambers, John M. (2008)
|
| 122 |
\emph{Software for Data Analysis: Programming with R}
|
128 |
\emph{Software for Data Analysis: Programming with R}
|
| 123 |
Springer. (For the R version.)
|
129 |
Springer. (Section 10.5)
|
| 124 |
|
130 |
|
| 125 |
Chambers, John M. (1998)
|
- |
|
| 126 |
\emph{Programming with Data}
|
- |
|
| 127 |
Springer (For the original S4 version).
|
- |
|
| 128 |
}
|
131 |
}
|
| 129 |
\seealso{ The function \code{\link{callGeneric}} is nearly always
|
132 |
\seealso{ The function \code{\link{callGeneric}} is nearly always
|
| 130 |
relevant when writing a method for a group generic. See the
|
133 |
relevant when writing a method for a group generic. See the
|
| 131 |
examples below and in section 10.5 of \emph{Software for Data Analysis}.
|
134 |
examples below and in section 10.5 of \emph{Software for Data Analysis}.
|
| 132 |
|
135 |
|