count: Count observations by group

Description Usage Arguments Value See Also Examples

Description

Analogous function for count and add_count in dplyr, wrapped directly from maditr.

Usage

1
2
3
count_dt(data, ..., weight = NULL, sort = FALSE, name = "n")

add_count_dt(data, ..., weight = NULL, sort = FALSE, name = "n")

Arguments

data

data.table/data.frame data.frame will be automatically converted to data.table.

...

variables to group by.

weight

optional. Unquoted variable name. If provided result will be the sum of this variable by groups.

sort

logical. If TRUE result will be sorted in desending order by resulting variable.

name

character. Name of resulting variable.

Value

data.table

See Also

count,dt_count

Examples

1
2
iris %>% count_dt(Species)
iris %>% add_count_dt(Species)

hope-data-science/tidydt0 documentation built on Feb. 3, 2020, 12:04 a.m.