dummy.code: Convert a factor to a matrix of dummy codes

View source: R/dummy.code.R

dummy.codeR Documentation

Convert a factor to a matrix of dummy codes

Description

Converts a factor (categorical) variable to a matrix of dummy codes using a 1 of C-1 binary coding scheme.

Usage

dummy.code(x)

Arguments

x

a factor variable.

Value

a matrix with the number of rows equal to the number of cases in x and the number of columns equal to one minus the number of factors in x. The last factor serves as the reference group.

Examples

  print(dummy.code(iris$Species))

qrnn documentation built on May 29, 2024, 1:27 a.m.