tabcount: Count distinct categories

Description Usage Arguments Value Examples

View source: R/tabcount.R

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

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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)

tabulator documentation built on Jan. 13, 2021, 12:56 p.m.