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

Reorder Levels of Factor

Description

The levels of a factor are re-ordered so that the level specified by ref is first and the others are moved down. This is useful for contr.treatment contrasts which take the first level as the reference.

Usage

relevel(x, ref, ...)

Arguments

x

An unordered factor.

ref

The reference level.

...

Additional arguments for future methods.

Value

A factor of the same length as x.

See Also

factor, contr.treatment, levels, reorder.

Examples

warpbreaks$tension <- relevel(warpbreaks$tension, ref="M")
summary(lm(breaks ~ wool + tension, data=warpbreaks))

[Package stats version 2.9.0 ]