count | R Documentation |
Returns row counts of the dataset.
tally()
returns counts by group on a grouped tidytable.
count()
returns counts by group on a grouped tidytable, or column names can be specified
to return counts by group.
count(.df, ..., wt = NULL, sort = FALSE, name = NULL)
tally(.df, wt = NULL, sort = FALSE, name = NULL)
.df |
A data.frame or data.table |
... |
Columns to group by in |
wt |
Frequency weights.
|
sort |
If |
name |
The name of the new column in the output. If omitted, it will default to |
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.