f_count | R Documentation |
Near-identical alternative to dplyr::count()
.
f_count(
data,
...,
wt = NULL,
sort = FALSE,
.order = group_by_order_default(data),
name = NULL,
.by = NULL,
.cols = NULL
)
f_add_count(
data,
...,
wt = NULL,
sort = FALSE,
.order = group_by_order_default(data),
name = NULL,
.by = NULL,
.cols = NULL
)
data |
A data frame. |
... |
Variables to group by. |
wt |
Frequency weights.
Can be
|
sort |
If |
.order |
Should the groups be calculated as ordered groups?
If |
name |
The name of the new column in the output.
If there's already a column called |
.by |
(Optional). A selection of columns to group by for this operation. Columns are specified using tidy-select. |
.cols |
(Optional) alternative to |
This is a fast and near-identical alternative to dplyr::count() using the collapse
package.
Unlike collapse::fcount()
, this works very similarly to dplyr::count()
.
The only main difference is that anything supplied to wt
is recycled and added as a data variable.
Other than that everything works exactly as the dplyr equivalent.
f_count()
and f_add_count()
can be up to >100x faster than the dplyr equivalents.
A data.frame
of frequency counts by group.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.