This is a simple calculation that doesn't take into account multi-year licenses, so it should only be used for initial data validation

summary_churn(x, years, rnd = 1, out = NULL, title = "Churn by Year",
  note = NULL, suppress_notes = FALSE)

Arguments

x

data frame: Table holding sales by year with a minimum of 2 variables (cust_id, year)

years

numeric: range of years needed to calculate churn

rnd

numeric: number of decimals to round pct change results

out

character: file path to optional output csv

title

character: title for output table

note

character: note for output table

suppress_notes

logical: If TRUE, returns a data frame only

See also

Other functions for validating license data: check_dups, count_lines_textfile, summary_initial, summary_sale

Examples

library(dplyr) data(sale, lic) summary_churn(sale, 2012:2018)
#> Churn by Year: #> (typical hunting: 20-45% --- typical fishing: 35-60%) #> ----------------------------------------------------- #> year churn #> 2013 48.5% #> 2014 46.6% #> 2015 51.8% #> 2016 53.6% #> 2017 53.8% #> 2018 55.0%
sale <- left_join(sale, lic)
#> Joining, by = "lic_id"
filter(sale, type %in% c("hunt", "combo")) %>% summary_churn(2012:2018, title = "Hunting Churn", note = "A note")
#> Hunting Churn: #> (typical hunting: 20-45% --- typical fishing: 35-60%) #> (A note) #> ------------------------------------------------------ #> year churn #> 2013 31.7% #> 2014 33.6% #> 2015 34.3% #> 2016 34.8% #> 2017 35.5% #> 2018 36.9%