This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/codes.html
codes {base}R Documentation

Factor Codes

Usage

codes(x)
codes(x) <- y

Value

This function retrieves the underlying integer codes used for the levels of a factor and can also be used to reset (a subset of) these codes.

See Also

factor, levels, nlevels.

Examples

x <- gl(3,5,15)
codes(x)[3] <- 2
all(unique(codes(x)) == 1:nlevels(x))#- should be true for ALL factors

[Package base version 0.60 ]