char2num {TwoPhaseInd}R Documentation

A function used in acoarm to transform categorical variable to integers

Description

Transform category data to integers 0..levels(data)-1. The the numeric variable can be then used in acoarm models.

Usage

char2num(data)

Arguments

data

data is a dataframe composed of categorical variables.

Details

The function transforms a categorical variable to integers.

Value

A data frame of transformed values. For each column, each category is transformed to an integer, from 0 to levels(data[,column])-1.

Author(s)

James Y. Dai

Examples

## Load the example data
data(acodata)
result <- char2num(acodata[, "fcgr2a.3"])

[Package TwoPhaseInd version 1.1.2 Index]