make_history: Make license history table

Description Usage Arguments Details See Also Examples

Description

The license history table accounts for multi-year/lifetime licenses by including 1 row for every year a license is held. The input data frame should only have 1 record per customer-year (ensured by running rank_sale beforehand).

Usage

1
2
make_history(sale_ranked, yrs, carry_vars = NULL, yrs_lapse = yrs,
  show_diagnostics = FALSE)

Arguments

sale_ranked

data frame: Sales table from which license history will be made; must include at least 3 variables (cust_id, year, duration)

yrs

numeric: Years in sales data (column 'year') from which to create license history

carry_vars

character: additional variables to carry over from previous year (for multi-year and lifetime licenses).

yrs_lapse

numeric: years to include in lapse calculation (defaults to yrs). If NULL, lapse will not be calculated (useful for mid-year results)

show_diagnostics

logical: If TRUE, will include intermediate variables in the output dataset, necessary for running checks: history_check.

Details

The output data frame includes the following variables:

See Also

Salic Function Reference: salic

Other license history functions: history_check, rank_sale

Examples

1
2
3
4
5
6
7
library(dplyr)
data(sale, lic)
sale_ranked <- inner_join(lic, sale) %>% rank_sale()
history <- make_history(sale_ranked, 2008:2018, "res")

# history includes more rows than sale_ranked if multi-year/lifetimes are present
left_join(count(history, year), count(sale_ranked, year), by = "year")

southwick-associates/salic documentation built on Nov. 5, 2019, 9:13 a.m.