df <- data.table(
x = 1:3,
y = 4:6,
z = c("a", "a", "b")
)
df %>%
count.()
df %>%
count.(z)
df %>%
count.(where(is.character))
df %>%
count.(z, wt = y, name = "y_sum")
df %>%
count.(z, sort = TRUE)
Run the code above in your browser using DataLab