\Header{Methods}{Internal and Group Methods and Generic Functions}
\alias{.Method}{Methods}
\alias{.Generic}{Methods}
\alias{.Group}{Methods}
\alias{.Class}{Methods}
\alias{Math.data.frame}{Methods}
\alias{Math.factor}{Methods}
\alias{Ops.data.frame}{Methods}
\alias{Ops.factor}{Methods}
\alias{Ops.ordered}{Methods}
\alias{Summary.data.frame}{Methods}
\alias{Summary.factor}{Methods}
\keyword{methods}{Methods}
\begin{Usage}
\begin{verbatim}
Math.data.frame(x, ...)
Math.factor(x, ...)

Ops.data.frame(e1, e2 = NULL)
Ops.factor(e1, e2)
Ops.ordered(e1, e2)

Summary.data.frame(x, ...)
Summary.factor(x, ...)

.Method
.Generic
.Group
.Class
\end{verbatim}
\end{Usage}
\begin{Description}
Many \R-internal functions  are \emph{generic} and  allow
methods to be written for.  \emph{Group} methods in particular are
available for the \texttt{"Math"},  \texttt{"Ops"}, and
\texttt{"Summary"} group.\end{Description}
\begin{Section}{Group Dispatching}
There are three \emph{groups} for which methods can be written, namely
the \texttt{"Math"}, \texttt{"Ops"} and \texttt{"Summary"} groups.

A function \emph{\texttt{f}} belonging to one of these groups must be
\texttt{\Link{.Internal}} or \texttt{\Link{.Primitive}} and will
automatically be using \emph{\texttt{<grp>.<class> (ob)}} when
\emph{\texttt{f(<ob>)}} is called, \emph{\texttt{f}} belongs to group
\emph{\texttt{<grp>}} and \emph{\texttt{<ob>}} is of \texttt{\Link{class}}
\emph{\texttt{<class>}}.

\Enumerate{
\item Group \texttt{"Math"}:
\Itemize{
\item \texttt{abs}, \texttt{sign}, \texttt{sqrt}, \\{}
\texttt{floor}, \texttt{ceiling}, \texttt{trunc},\\{}
\texttt{round}, \texttt{signif}


\item \texttt{exp}, \texttt{log}, \\{}
\texttt{cos}, \texttt{sin}, \texttt{tan},\\{}
\texttt{acos}, \texttt{asin}, \texttt{atan}

\texttt{cosh}, \texttt{sinh}, \texttt{tanh},\\{}
\texttt{acosh}, \texttt{asinh}, \texttt{atanh}

\item \texttt{lgamma}, \texttt{gamma}, \texttt{gammaCody},\\{}
\texttt{digamma}, \texttt{trigamma}, \texttt{tetragamma},
\texttt{pentagamma}

\item \texttt{cumsum}, \texttt{cumprod}, \texttt{cummax}, \texttt{cummin}
}

\item Group \texttt{"Ops"}:
\Itemize{
\item \texttt{"+"}, \texttt{"-"}, \texttt{"*"}, \texttt{"/"},
\texttt{"$\,\hat{\,}$"}, \texttt{"\%\%"}, \texttt{"\%/\%"}

\item \texttt{"\&"}, \texttt{"|"}, \texttt{"!"}

\item \texttt{"=="}, \texttt{"!="}, 
\texttt{"<"}, \texttt{"<="}, \texttt{">="}, \texttt{">"}
}

\item Group \texttt{"Summary"}:
\Itemize{
\item \texttt{all}, \texttt{any}

\item \texttt{sum}, \texttt{prod}
\item \texttt{min}, \texttt{max}
}
}\end{Section}
\begin{Section}{Simple Dispatching}
The following builtin functions are \emph{generic} as well, i.e., you
can write \texttt{\Link{methods}} for them:

\texttt{\Link{[}},		
\texttt{\Link{[[}}		

\texttt{\Link{dimnames<-}},	
\texttt{\Link{dimnames}},	
\texttt{\Link{dim<-}},	
\texttt{\Link{dim}}		

\texttt{\Link{c}}, 
\texttt{\Link{unlist}}, 
\texttt{\Link{as.vector}}, 
\texttt{\Link{is.na}}, 
\texttt{\Link{is.nan}}\end{Section}
\begin{References}
Appendix A, \emph{Classes and Methods} of \\{}
Chambers and Hastie (1992). \emph{Statistical Models in S};
Wadsworth \& Brooks/Cole.\end{References}
\begin{SeeAlso}
\texttt{\Link{methods}} for methods of non-Internal generic functions.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
methods("Math")
methods("Ops")
methods("Summary")

d.fr <- data.frame(x=1:9, y=rnorm(9))
data.class(1 + d.fr) == "data.frame" ##-- add to d.f. ...
\end{ExampleCode}
\end{Examples}

