class.ind: Convert factor to a dummy/indicator matrix

Description Usage Arguments Value Examples

View source: R/simpleNN.R

Description

class.ind take a factor vector of length $n$ with $k$ levels and outputs an $n$ x $k$ indicator matrix.

Usage

1

Arguments

cl

factor vector

Value

Appropriate indicator matrix.

Examples

1
2
3
4
# Random factor data
dat <- factor(sample(1:3,100, replace=TRUE))
# Get the ggplot object
indicatorMatrix <- class.ind(dat)

gumeo/mnistr documentation built on May 17, 2019, 9:27 a.m.