File: createDummyFeatures.Rd

package info (click to toggle)
r-cran-mlr 2.19.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,264 kB
  • sloc: ansic: 65; sh: 13; makefile: 5
file content (55 lines) | stat: -rw-r--r-- 1,821 bytes parent folder | download | duplicates (3)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/createDummyFeatures.R
\name{createDummyFeatures}
\alias{createDummyFeatures}
\title{Generate dummy variables for factor features.}
\usage{
createDummyFeatures(
  obj,
  target = character(0L),
  method = "1-of-n",
  cols = NULL
)
}
\arguments{
\item{obj}{(\link{data.frame} | \link{Task})\cr
Input data.}

\item{target}{(\code{character(1)} | \code{character(2)} | \code{character(n.classes)})\cr
Name(s) of the target variable(s).
Only used when \code{obj} is a data.frame, otherwise ignored.
If survival analysis is applicable, these are the names of the survival time and event columns,
so it has length 2.
For multilabel classification these are the names of logical columns that indicate whether
a class label is present and the number of target variables corresponds to the number of
classes.}

\item{method}{(\code{character(1)})\cr
Available are:
\describe{
\item{"1-of-n":}{For n factor levels there will be n dummy variables.}
\item{"reference":}{There will be n-1 dummy variables leaving out the first factor level of each variable.}
}
Default is \dQuote{1-of-n}.}

\item{cols}{(\link{character})\cr
Columns to create dummy features for. Default is to use all columns.}
}
\value{
\link{data.frame} | \link{Task}. Same type as \code{obj}.
}
\description{
Replace all factor features with their dummy variables. Internally \link{model.matrix} is used.
Non factor features will be left untouched and passed to the result.
}
\seealso{
Other eda_and_preprocess: 
\code{\link{capLargeValues}()},
\code{\link{dropFeatures}()},
\code{\link{mergeSmallFactorLevels}()},
\code{\link{normalizeFeatures}()},
\code{\link{removeConstantFeatures}()},
\code{\link{summarizeColumns}()},
\code{\link{summarizeLevels}()}
}
\concept{eda_and_preprocess}