count | R Documentation |
Analogous function for count
and add_count
in dplyr.
count(.data, ..., sort = FALSE, name = "n")
add_count(.data, ..., name = "n")
.data |
data.table |
... |
variables to group by. |
sort |
logical. If TRUE result will be sorted in desending order by resulting variable. |
name |
character. Name of resulting variable. Default uses "n". |
data.table
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.