Bins the target variable and plots the total exposure per bin as a bar
chart — an exposure-weighted distribution of the target. Shares its
argument conventions, binning, NA handling, split behaviour, and plotly
styling with one_way(); the only difference is that the target itself is
the x-axis variable, so there is no obs argument.
Arguments
- data
A data frame or data.table. Must contain all columns referenced by other arguments.
- ...
Arguments passed to methods.
- var
Target column whose distribution to plot. Bare name or string. Default
"target".- exposure
Column of exposure weights. If the column does not exist in
data, every row is given weight 1. Bare name or string. Default"exposure".- split
Optional column to group bars by. Bare name, string, or
NA/NULLfor no split. DefaultNA.- bins
[integer(1)]Number of equal-exposure bins for numeric targets with more thanbinsunique values. Default 35.- time_unit
[character(1)]For Date / POSIXct targets, the width of each bin (passed tobase::cut.POSIXt()). DefaultNA.- type_agg
[character(1)]Binning strategy for numeric targets:"equal_exposure"(default) or"equal_range".- ret
[character(1)]"plot"(default) returns a plotly object;"data"returns the aggregated data.table.- verbose
[logical(1)]Report how many NA values ofvarwere moved to the trailing"NA"category? DefaultFALSE.
Value
A plotly object, or a data.table when ret = "data", or NULL
with a warning if the plot cannot be produced.