powered by
Analogous function for count and add_count in dplyr.
count
add_count
count(.data, ..., sort = FALSE, name = "n")add_count(.data, ..., name = "n")
add_count(.data, ..., name = "n")
data.table
variables to group by.
logical. If TRUE result will be sorted in desending order by resulting variable.
character. Name of resulting variable. Default uses "n".
a = as.data.table(mtcars) count(a,cyl) count(a,cyl,sort = TRUE) a b = as.data.table(iris) b %>% add_count(Species,name = "N") b
Run the code above in your browser using DataLab