Description Usage Arguments See Also Examples
This function expects a data frame produced by an salic estimation function (
est_part
, est_recruit
, est_churn
).
It returns a data frame with additional formatting that allows stacking all results
into a single table.
1 2 | format_result(df, timeframe, group, rename_input = c("category", "year",
"value"))
|
df |
data frame: Input table (3 variables) with estimated metrics |
timeframe |
character: value to store in the 'timeframe' variable of the output (e.g, 'full-year', 'mid-year') |
group |
character: value to sore in the 'group' variable of the output (e.g., 'all_sports', 'fish', 'hunt') |
rename_input |
character: generic names for input variables as they will appear in the output |
Salic Function Reference: salic
Other dashboard functions: check_threshold
,
est_churn
, est_part
,
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 | library(dplyr)
data(metrics)
# format a table
metrics$participants$res
x <- format_result(metrics$participants$res, "full-year", "all_sports")
x
# combine formatted tables
y <- format_result(metrics$participants$tot, "full-year", "all_sports")
bind_rows(y, x)
# apply formatting across all segments
x <- lapply(metrics$participants, function(x) format_result(x, "full-year", "sports"))
bind_rows(x)
# apply across all metrics & segments
bind_rows(
lapply(metrics$participants, function(x) format_result(x, "full-year", "sports")),
lapply(metrics$recruits, function(x) format_result(x, "full-year", "sports")),
lapply(metrics$churn, function(x) format_result(x, "full-year", "sports"))
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.