Description Usage Arguments See Also Examples
The action is only triggered if any values in df[[test_variable]] exceed test_threshold. Intended for use in calculating dashboard metrics.
1 2 3 4 |
df |
data frame: table containing statistic to check |
test_threshold |
numeric: if exceeded, while produce warning |
test_variable |
character: Name of variable in df that contains the test statistic |
action |
function: function call to perform if threshold is exceeded
(intended to be |
msg |
character: message to be printed in action |
Other dashboard functions: est_churn
,
est_part
, format_result
,
scaleup_part
1 2 3 4 5 6 7 8 9 | library(dplyr)
# produce warnings
x <- data.frame(tot = "All", year = 2008:2018, part = rnorm(11, 1000, sd = 100))
x <- mutate(x, pct_change = (part - lag(part)) / lag(part) * 100)
check_threshold(x, 5)
# this will produce an error
# check_threshold(x, 5, action = function(...) stop(..., call. = FALSE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.