tabcount {tabulator} | R Documentation |
Count distinct categories
Description
Produces a count of unique categories,
tabcount
shows the number of
unique categories for the selected variable.
Accepts data.table, tibble, or data.frame as input.
Efficient with big data: if you give it a data.table
,
tabcount
uses data.table
syntax.
Usage
tabcount(df, ...)
Arguments
df |
A data.table, tibble, or data.frame |
... |
A column or set of columns (without quotation marks) |
Value
Count of the number of unique groups formed by the variables given in ...
from df
.
Examples
# data.table
library(data.table)
library(magrittr)
a <- data.table(varname = sample.int(20, size = 1000000, replace = TRUE))
a %>% tabcount(varname)
# tibble
library(dplyr)
b <- tibble(varname = sample.int(20, size = 1000000, replace = TRUE))
b %>% tabcount(varname)
[Package tabulator version 1.0.0 Index]