Learn R Programming

mcboost (version 0.4.3)

one_hot: One-hot encode a factor variable

Description

One-hot encode a factor variable

Usage

one_hot(labels)

Value

integer

Integer vector of encoded labels.

Arguments

labels

factor
Factor to encode.

Examples

Run this code
 if (FALSE) {
 one_hot(factor(c("a", "b", "a")))
 }

Run the code above in your browser using DataLab