\Header{class.ind}{Generates Class Indicator Matrix from a Factor}
\keyword{neural}{class.ind}
\keyword{utilities}{class.ind}
\begin{Description}\relax
Generates a class indicator function from a given factor.\end{Description}
\begin{Usage}
\begin{verbatim}
class.ind(cl)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{cl}] factor or vector of classes for cases.

\end{ldescription}
\end{Arguments}
\begin{Value}
a matrix which is zero except for the column corresponding to the class.\end{Value}
\begin{References}\relax
Venables, W. N. and Ripley, B. D. (2002)
\emph{Modern Applied Statistics with S.} Fourth edition.  Springer.\end{References}
\begin{Examples}
\begin{ExampleCode}
# The function is currently defined as
class.ind <- function(cl)
{
  n <- length(cl)
  cl <- as.factor(cl)
  x <- matrix(0, n, length(levels(cl)) )
  x[(1:n) + n*(unclass(cl)-1)] <- 1
  dimnames(x) <- list(names(cl), levels(cl))
  x
}
\end{ExampleCode}
\end{Examples}

