Add a new column named "n" with (optionally per-group) sums/counts.

count_se(x, groupingVars = NULL, wt = NULL, sort = FALSE)

Arguments

x

data.frame to tally/count

groupingVars

character vector of column names to group by.

wt

character optional column name containing row-weights (passed to count/tally)

sort

logical if TRUE sort result in descending order

Value

.data with added column n, containing counts.

Details

Note: dplyr::count, dplyr::add_count, dplyr::tally, and dplyr::add_tally are not S3 methods, so it may not be practical to re-dispatch seplyr calls to these dplyr implementations.

See also

Examples

datasets::mtcars %.>% count_se(., groupingVars= c('cyl', 'gear'))
#> cyl gear n #> 1 4 3 1 #> 2 4 4 8 #> 3 4 5 2 #> 4 6 3 2 #> 5 6 4 4 #> 6 6 5 1 #> 7 8 3 12 #> 8 8 5 2