% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/model-matrix.R
\name{contr_one_hot}
\alias{contr_one_hot}
\title{Contrast function for one-hot encodings}
\usage{
contr_one_hot(n, contrasts = TRUE, sparse = FALSE)
}
\arguments{
\item{n}{A vector of character factor levels or the number of unique levels.}

\item{contrasts}{This argument is for backwards compatibility and only the
default of \code{TRUE} is supported.}

\item{sparse}{This argument is for backwards compatibility and only the
default of \code{FALSE} is supported.}
}
\value{
A diagonal matrix that is \code{n}-by-\code{n}.
}
\description{
This contrast function produces a model matrix that has indicator columns for
each level of each factor.
}
\keyword{internal}
