slice_top_categories | R Documentation |
This slices a dataframe to only include the most frequent
slice_top_categories(.data, .n, ..., .wt = NULL)
.data |
a dataframe |
.n |
the number of categories to include |
... |
columns which define categories |
.wt |
an optional weight category |
A dataframe containing only the top categories
# give the top 1 most occuring value of `cyl` slice_top_categories(mtcars, 1, cyl) # give the top 1 most occuring value of `cyl` weighted by am slice_top_categories(mtcars, 1, cyl, .wt = am) # give the 2 most occuring values of (cyl, gear) pair slice_top_categories(mtcars, 2, cyl, gear)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.