\Header{tabulate}{Tabulation for Vectors}
\keyword{arith}{tabulate}
\begin{Description}\relax
\code{tabulate} takes the integer valued vector \code{bin} and counts
the number of times each integer occurs in it.  \code{tabulate} is
used as the basis of the \code{table} function.\end{Description}
\begin{Usage}
\begin{verbatim}
tabulate(bin, nbins = max(1, bin))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{bin}] a vector of integers, or a factor.
\item[\code{nbins}] the number of bins to be used.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
If \code{bin} is a factor, its internal integer representation
is tabulated.
If the elements of \code{bin} are not integers, they are rounded
to the nearest integer.  Elements outside the range \code{1,...,
    nbin} are (silently) ignored in the tabulation.\end{Details}
\begin{SeeAlso}\relax
\code{\Link{factor}}, \code{\Link{table}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

tabulate(c(2,3,5))
tabulate(c(2,3,3,5), nb = 10)
tabulate(c(-2,0,2,3,3,5), nb = 3)
tabulate(factor(letters[1:10]))
\end{ExampleCode}
\end{Examples}

