EVOLUTION-MANAGER
Edit File: relevel.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Reorder Levels of Factor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for relevel {stats}"><tr><td>relevel {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Reorder Levels of Factor</h2> <h3>Description</h3> <p>The levels of a factor are re-ordered so that the level specified by <code>ref</code> is first and the others are moved down. This is useful for <code>contr.treatment</code> contrasts which take the first level as the reference. </p> <h3>Usage</h3> <pre> relevel(x, ref, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an unordered factor.</p> </td></tr> <tr valign="top"><td><code>ref</code></td> <td> <p>the reference level, typically a string.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>additional arguments for future methods.</p> </td></tr> </table> <h3>Details</h3> <p>This, as <code><a href="reorder.factor.html">reorder</a>()</code>, is a special case of simply calling <code><a href="../../base/html/factor.html">factor</a>(x, levels = levels(x)[....])</code>. </p> <h3>Value</h3> <p>A factor of the same length as <code>x</code>. </p> <h3>See Also</h3> <p><code><a href="../../base/html/factor.html">factor</a></code>, <code><a href="contrast.html">contr.treatment</a></code>, <code><a href="../../base/html/levels.html">levels</a></code>, <code><a href="reorder.factor.html">reorder</a></code>. </p> <h3>Examples</h3> <pre> warpbreaks$tension <- relevel(warpbreaks$tension, ref = "M") summary(lm(breaks ~ wool + tension, data = warpbreaks)) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>