powered by
Calculates weighted counts grouped by optional columns.
grouped_counts(data, by = NULL, w = NULL, value_name = "n", ...)
A data.frame with columns by and value_name.
data.frame
by
value_name
A data.frame.
An optional vector of column names in data used to group the results.
data
Optional name of the column in data with case weights.
Name of the resulting column with counts.
Arguments passed to sum() (only if weights are provided).
sum()
grouped_counts(iris) grouped_counts(iris, by = "Species") grouped_counts(iris, w = "Petal.Length") grouped_counts(iris, by = "Species", w = "Petal.Length")
Run the code above in your browser using DataLab