calc_churn: Internal Function: Calculate churn for a single year

Description Usage Arguments Value See Also Examples

View source: R/prepare.R

Description

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

Usage

1
calc_churn(x, yr)

Arguments

x

data frame: Table holding sales by year

yr

numeric: year to calculate churn (e.g., churn for 2014 uses sales for 2 years: 2013 and 2014)

Value

Returns a numeric vector of length 1

See Also

Other internal helper functions: format_num, pct_round, print_dat

Examples

1
2
3
4
5
6
7
library(dplyr)
data(sale)

select(sale, cust_id, year) %>%
    filter(year %in% 2012:2013) %>% 
    distinct() %>%
    calc_churn(2013)

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