EVOLUTION-MANAGER
Edit File: fct_collapse.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: Collapse factor levels into manually defined groups</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_collapse {forcats}"><tr><td>fct_collapse {forcats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Collapse factor levels into manually defined groups</h2> <h3>Description</h3> <p>Collapse factor levels into manually defined groups </p> <h3>Usage</h3> <pre> fct_collapse(.f, ..., other_level = NULL, group_other = "DEPRECATED") </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>...</code></td> <td> <p><<code><a href="../../rlang/html/dyn-dots.html">dynamic-dots</a></code>> A series of named character vectors. The levels in each vector will be replaced with the name.</p> </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> <tr valign="top"><td><code>group_other</code></td> <td> <p>Deprecated. Replace all levels not named in <code>...</code> with "Other"?</p> </td></tr> </table> <h3>Examples</h3> <pre> fct_count(gss_cat$partyid) partyid2 <- fct_collapse(gss_cat$partyid, missing = c("No answer", "Don't know"), other = "Other party", rep = c("Strong republican", "Not str republican"), ind = c("Ind,near rep", "Independent", "Ind,near dem"), dem = c("Not str democrat", "Strong democrat") ) fct_count(partyid2) </pre> <hr /><div style="text-align: center;">[Package <em>forcats</em> version 0.5.0 <a href="00Index.html">Index</a>]</div> </body></html>