calc_weighted_mean: Calculates a weighted mean based on grouping criteria you set

Description Usage Arguments Value

View source: R/calc_weighted_mean.R

Description

Takes a dataframe and calculates a weighted mean based on a chosen denominator and numerator column.

Usage

1
calc_weighted_mean(data, numerator_col, denominator_col, multiplier = 1, ...)

Arguments

data

The data frame/table holding the information you'd like to calculate a weighted mean for

numerator_col

Value field that when aggregated will be the numerator in the calculation to work out weighted mean

denominator_col

Value field that when aggregated will be the denominator in the calculation to work out a weighted mean.

multiplier

A figure to divide your denominator by if your processing involves counting it multiple times.

...

Any columns you would like to group the data by when aggregating.

Value

A data frame containing the weighted mean for each group of data calculated.


shanej90/commoncalcs documentation built on Oct. 21, 2020, 8:43 a.m.