\Header{Extremes}{Maxima and Minima}
\alias{max}{Extremes}
\alias{min}{Extremes}
\alias{pmax}{Extremes}
\alias{pmin}{Extremes}
\keyword{univar}{Extremes}
\keyword{arith}{Extremes}
\begin{Usage}
\begin{verbatim}
max(..., na.rm=FALSE)
min(..., na.rm=FALSE)

pmax(..., na.rm=FALSE)
pmin(..., na.rm=FALSE)
\end{verbatim}
\end{Usage}
\begin{Value}
\texttt{max} and \texttt{min} return the maximum or minimum of all the values
present in their arguments, as \texttt{\Link{double}}.
If \texttt{na.rm} is \texttt{FALSE} an \texttt{NA} value in any
of the arguments will cause a value of \texttt{NA} to be returned,
otherwise \texttt{NA} values are ignored.

\texttt{pmax} and \texttt{pmin} take several vectors as arguments and return a
single vector giving the parallel maxima (or minima) of the vectors.
The first element of the result is the maximum (minimum) of the first
elements of all the arguments, the second element of the result is the
maximum (minimum) of the second elements of all the arguments and so on.
Shorter vectors are recycled if necessary.  If \texttt{na.rm} is \texttt{FALSE},
\texttt{NA} values in the input vectors will produce \texttt{NA} values in the
output.  If \texttt{na.rm} is \texttt{TRUE}, \texttt{NA} values are ignored.\end{Value}
\begin{SeeAlso}
\texttt{\Link{range}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
min(5:1,pi)
pmin(5:1, pi)
x <- sort(rnorm(100));  cH <- 1.35
plot(x, pmin(cH, pmax(-cH, x)), type='b', main= "Huber's function")
\end{ExampleCode}
\end{Examples}

