codes {str2str}R Documentation

Integer Codes of Factor Levels

Description

codes returns the integer codes for each factor level from a factor.

Usage

codes(fct)

Arguments

fct

factor.

Value

integer vector with length = length(levels(fct)), elements = integer codes of fct and names = levels(fct).

Examples

codes(state.region)
codes(iris$"Species")

[Package str2str version 1.0.0 Index]