EVOLUTION-MANAGER
Edit File: top_levels.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: Generate a frequency table of a factor grouped into top-n,...</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 top_levels {janitor}"><tr><td>top_levels {janitor}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Generate a frequency table of a factor grouped into top-n, bottom-n, and all other levels.</h2> <h3>Description</h3> <p>Get a frequency table of a factor variable, grouped into categories by level. </p> <h3>Usage</h3> <pre> top_levels(input_vec, n = 2, show_na = FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>input_vec</code></td> <td> <p>the factor variable to tabulate.</p> </td></tr> <tr valign="top"><td><code>n</code></td> <td> <p>number of levels to include in top and bottom groups</p> </td></tr> <tr valign="top"><td><code>show_na</code></td> <td> <p>should cases where the variable is NA be shown?</p> </td></tr> </table> <h3>Value</h3> <p>Returns a data.frame (actually a <code>tbl_df</code>) with the frequencies of the grouped, tabulated variable. Includes counts and percentages, and valid percentages (calculated omitting <code>NA</code> values, if present in the vector and <code>show_na = TRUE</code>.) </p> <h3>Examples</h3> <pre> top_levels(as.factor(mtcars$hp), 2) </pre> <hr /><div style="text-align: center;">[Package <em>janitor</em> version 2.1.0 <a href="00Index.html">Index</a>]</div> </body></html>