EVOLUTION-MANAGER
Edit File: fct_other.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: Replace levels with "other"</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 fct_other {forcats}"><tr><td>fct_other {forcats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Replace levels with "other"</h2> <h3>Description</h3> <p>Replace levels with "other" </p> <h3>Usage</h3> <pre> fct_other(f, keep, drop, other_level = "Other") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>f</code></td> <td> <p>A factor (or character vector).</p> </td></tr> <tr valign="top"><td><code>keep, drop</code></td> <td> <p>Pick one of <code>keep</code> and <code>drop</code>: </p> <ul> <li> <p><code>keep</code> will preserve listed levels, replacing all others with <code>other_level</code>. </p> </li> <li> <p><code>drop</code> will replace listed levels with <code>other_level</code>, keeping all as is. </p> </li></ul> </td></tr> <tr valign="top"><td><code>other_level</code></td> <td> <p>Value of level used for "other" values. Always placed at end of levels.</p> </td></tr> </table> <h3>See Also</h3> <p><code><a href="fct_lump.html">fct_lump()</a></code> to automatically convert the rarest (or most common) levels to "other". </p> <h3>Examples</h3> <pre> x <- factor(rep(LETTERS[1:9], times = c(40, 10, 5, 27, 1, 1, 1, 1, 1))) fct_other(x, keep = c("A", "B")) fct_other(x, drop = c("A", "B")) </pre> <hr /><div style="text-align: center;">[Package <em>forcats</em> version 0.5.0 <a href="00Index.html">Index</a>]</div> </body></html>