Description Usage Arguments Value See Also Examples
This function requires a correctly formated history table (see history
).
It produces a simple count of records per year, optionally by segment,
& runs a validation test: pct change per year.
1 2 3 4 5 6 7 |
history |
data frame: input license history table |
segment |
character: defaults to "tot", which indicates no segmentation. Alternatively specifiy other license history variables ("res", "sex", etc.) |
test_threshold |
numeric: threshold in whole number percentage points for pct change per year. A warning will be printed if the absolute value of the change for any year exceeds the threshold. |
show_test_stat |
logical: If TRUE, the output table will include a variable holding the test statistic for each row. |
suppress_warning |
logical: If TRUE, no test warning will be displayed (even if threshold is exceeded). Test statistics can still be included by setting show_test_stat = TRUE. |
outvar |
character: name of variable that stores metric |
Returns a data frame with 3 variables (segment, "year", outvar), and optionally with 2 extra variables ("change", "pct_change") if show_test_stat = TRUE
Salic Function Reference: salic
Other dashboard functions: check_threshold
,
est_churn
, format_result
,
scaleup_part
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | library(dplyr)
data(history)
history <- history %>%
label_categories() %>%
recode_agecat() %>%
filter(!agecat %in% c("0-17", "65+"))
# participants
est_part(history)
# by segment
# produces a warning
est_part(history, "agecat")
# suppress warning
x <- est_part(history, "agecat", test_threshold = 25)
# new recruits
history_new <- filter(history, !is.na(R3), R3 == "Recruit")
est_recruit(history_new)
# apply over multiple segments
segs <- c("tot", "res", "sex", "agecat")
part <- sapply(segs, function(x) est_part(history, x), simplify = FALSE)
# specify test thesholds by segment to suppress warnings
tests <- c(tot = 20, res = 45, sex = 30, agecat = 40)
part <- sapply(segs, function(x) est_part(history, x, tests[x]), simplify = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.