\Header{which.min}{Where is the Min() or Max() ?}
\alias{which.max}{which.min}
\keyword{utilities}{which.min}
\begin{Description}\relax
Determines the location, i.e., index of the (first) minimum or maximum
of a numeric vector.\end{Description}
\begin{Usage}
\begin{verbatim}
which.min(x)
which.max(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] numeric vector, whose \code{\Link{min}} or \code{\Link{max}}
is searched.
\end{ldescription}
\end{Arguments}
\begin{Value}
an \code{\Link{integer}} of length 1 or 0 (iff \code{x} has no
non-\code{NA}s) , giving the index of the \emph{first} minimum or
maximum respectively of \code{x}.

If this extremum is unique (or empty), the result is the same (but more
efficient) as  \code{which(x == min(x))} or \code{which(x == max(x))}
respectively.\end{Value}
\begin{Author}\relax
Martin Maechler\end{Author}
\begin{SeeAlso}\relax
\code{\Link{which}}, \code{\Link{max.col}}, \code{\Link{max}}, etc.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- c(1:4,0:5,11)
which.min(x)
which.max(x)

data(presidents)
presidents[1:30]
range(presidents, na.rm = TRUE)
which.min(presidents)# 28
which.max(presidents)# 2

\end{ExampleCode}
\end{Examples}

