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