count_dt | R Documentation |
Count the unique values of one or more variables.
count_dt(.data, ..., sort = TRUE, .name = "n")
add_count_dt(.data, ..., .name = "n")
.data |
data.table/data.frame data.frame will be automatically converted to data.table. |
... |
Variables to group by, could receive what 'select_dt' receives. |
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
count
iris %>% count_dt(Species)
iris %>% count_dt(Species,.name = "count")
iris %>% add_count_dt(Species)
iris %>% add_count_dt(Species,.name = "N")
mtcars %>% count_dt(cyl,vs)
mtcars %>% count_dt("cyl|vs")
mtcars %>% count_dt(cyl,vs,.name = "N",sort = FALSE)
mtcars %>% add_count_dt(cyl,vs)
mtcars %>% add_count_dt("cyl|vs")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.