\HeaderA{nlevels}{The Number of Levels of a Factor}{nlevels}
\keyword{category}{nlevels}
\begin{Description}\relax
Return the number of levels which its argument has.
\end{Description}
\begin{Usage}
\begin{verbatim}
nlevels(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an object, usually a factor.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This is usually applied to a factor, but other objects can have levels.

The actual factor levels (if they exist) can be obtained
with the \code{\LinkA{levels}{levels}} function.
\end{Details}
\begin{Value}
The length of \code{\LinkA{levels}{levels}(x)}, which is zero if
\code{x} has no levels.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{levels}{levels}}, \code{\LinkA{factor}{factor}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
nlevels(gl(3,7)) # = 3
\end{ExampleCode}
\end{Examples}

