twoway: Segment a dataset along a variable, and optionally a second...

Description Usage Arguments Value

Description

Computes the weighted mean of a target variable accross one or two dimensions. The first dimension (variable) is meant to be plotted along the x-axis, while the values of the second variable will be mapped to color aesthetics.

Usage

1
2
twoway(data, target, var, var2 = NULL, weight = NULL, exposure = NULL,
  quantiles = FALSE, labels = NULL, quantiles2 = FALSE, labels2 = NULL)

Arguments

data

The data to segment.

target

Name of the target variable.

var

Character, name of the variable to segment accross.

var2

Optional, character name of the 2nd variable. This is useful to see interaction between two variables and a target variable.

weight

Optional, name of the variable in 'data' to be used as weights in the weighted average calculation.

exposure

Optional, name of the variable in 'data' that represents the exposure. This will be shown as bars when plotted.

quantiles

Should 'var' be quantilized ? If an integer, represents the number of quantiles to use. If TRUE, 5 quantiles will be used.

labels

Labels to use for 'var' quantiles. Default is to show the interval bounds.

quantiles2

Should 'var2' be quantilized ? If an integer, represents the number of quantiles to use. If TRUE, 5 quantiles will be used.

laels2

Labels to use for 'var2' quantiles. Default is to show the interval bounds.

Value

A summarized dataset.


artichaud1/twoway documentation built on May 12, 2019, 5:43 a.m.