grouped_counts: Grouped count

View source: R/grouped_counts.R

grouped_countsR Documentation

Grouped count

Description

Calculates weighted counts grouped by optional columns.

Usage

grouped_counts(data, by = NULL, w = NULL, value_name = "n", ...)

Arguments

data

A data.frame.

by

An optional vector of column names in data used to group the results.

w

Optional name of the column in data with case weights.

value_name

Name of the resulting column with counts.

...

Arguments passed to sum() (only if weights are provided).

Value

A data.frame with columns by and value_name.

Examples

grouped_counts(iris)
grouped_counts(iris, by = "Species")
grouped_counts(iris, w = "Petal.Length")
grouped_counts(iris, by = "Species", w = "Petal.Length")

flashlight documentation built on May 31, 2023, 6:19 p.m.