

   relevel {base}                               R Documentation

   RReeoorrddeerr LLeevveellss ooff FFaaccttoorr

   DDeessccrriippttiioonn::

        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.

   UUssaaggee::

        relevel(x, ref, ...)

   AArrgguummeennttss::

          x: An unordered factor.

        ref: The reference level.

        ...: Additional arguments for future methods.

   VVaalluuee::

        A factor of the same length as `x'.

   AAuutthhoorr((ss))::

        B. D. Ripley

   SSeeee AAllssoo::

        `factor', `contr.treatment'

   EExxaammpplleess::

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

