calc_weights: Generate weights for a given set of users

Description Usage Arguments Value Examples

View source: R/helper_functions.R

Description

This function calculates weights for a set of users, based on predefined targets

Usage

1
calc_weights(df, y, min.cap = -Inf, max.cap = Inf)

Arguments

df

A dataframe containing metric values

y

A df that contains quotas (i.e. targets) that will be used to determine weights

min

Lower cap weight floor. Defaults to -Inf

max

Upper cap weight ceiling. Defaults to Inf

Value

A list object containing the input df with weights attached, and proportions for each variable used

Examples

1
2
3
targets <- calc_props(df.test, 'user_id')
df.list <- calc_weights(df.control, targets)
df.weighted <- df.list$df

cchoe/infoscout documentation built on May 20, 2019, 5:42 p.m.