\Header{rank}{Sample Ranks}
\keyword{univar}{rank}
\begin{Usage}
\begin{verbatim}
rank(x)
\end{verbatim}
\end{Usage}
\begin{Description}
\texttt{rank} returns the sample ranks of the values in \texttt{x}.
Ties result in ranks being averaged.
\texttt{NA} values are not allowed in this function.\end{Description}
\begin{SeeAlso}
\texttt{\Link{order}} and \texttt{\Link{sort}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
(r1 <- rank(x1 <- c(3,1,4,59,26)))
all(rank(r1) == r1) ## rank() is "idempotent": rank(rank(x)) == rank(x)
(r2 <- rank(x2 <- c(3,1,4,5,9,2,6,5,3,5)))
all(rank(r2) == r2)
\end{ExampleCode}
\end{Examples}

