File: contr_one_hot.Rd

package info (click to toggle)
r-cran-hardhat 1.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,656 kB
  • sloc: sh: 13; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 761 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
% 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}