Learn R Programming

str2str (version 1.0.0)

codes: Integer Codes of Factor Levels

Description

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

Usage

codes(fct)

Value

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

Arguments

fct

factor.

Examples

Run this code
codes(state.region)
codes(iris$"Species")

Run the code above in your browser using DataLab