View source: R/fct_inspection.R
check_sum_probs | R Documentation |
This function checks whether the sum of user-defined variables representing probabilities is below or equal to 1 for each iteration of the probabilistic inputs.
check_sum_probs(..., df, digits = NULL, check = "lower", max_view = 100)
... |
character vector. This character vector contains the name of the variables of which the sum will be checked. |
df |
a dataframe. |
digits |
numeric. Define the number of digits at which the sum of probabilities should be rounded. |
check |
logical. Define which test to perform."lower" tests whether the sum of the selected variables is lower than or equal to 1 for each iteration. "equal" tests whether the sum of the selected variables is equal to 1 for each iteration. Default is "lower". |
max_view |
numeric. Determines the number of iterations to display which do not fulfill the test Default is 100. |
A text indicating whether the sum of the probabilities is belor and/or eual to one or indicating in which iteration that is not the case.
# Checking whether the sum of the two probabilities is lower than or equal to 1
check_sum_probs("p_pfspd", "p_pfsd", df = df_pa, check = "lower")
# Checking the sum of the two probabilities equals 1 using a vector to select them,
# Rounding off to two digits, and extending the number of iterations to display to 250.
check_sum_probs(c("p_pfspd", "p_pfsd"), df = df_pa, digits = 2, check = "equal", max_view = 250)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.