Learn R Programming

NominalLogisticBiplot (version 0.2)

Nominal2Binary: Transformation of a nominal variable into a binary indicator matrix

Description

This function transforms a nominal variable into a binary matrix with as many colums as categories. Each row of the matrix has a value of 1 for the corresponding level of the category and 0 elsewhere.

Usage

Nominal2Binary(y)

Arguments

y
A vector containing the values of nominal variable measured on a set of individuals- The values must be integers starting at 1.

Value

An object of type matrix:
Z
The binary indicator matrix asociated to the nominal variable

Examples

Run this code
  
  data(HairColor)
  Nominal2Binary(as.numeric(HairColor[,1]))
  

Run the code above in your browser using DataLab