one_hot: Transform a catagorical variable to one hot representation

Description Usage Arguments Value Examples

View source: R/one_hot.R

Description

The one hot representation is analogous to factors in the sense that each value of the catagorical variable have its own logical vector that is 1 when present and 0 when it isn't.

Usage

1

Arguments

data

a data.frame or tibble.

var

name of catagorical variable.

Value

A data.frame or tibble with the catagorical variable replaced with an one hot representation.

Examples

1
one_hot(iris, Species)

GarrettMooney/moonmisc documentation built on Oct. 19, 2019, 7:51 p.m.