Skip to content

Commit

Permalink
Add overall materiality to evaluation table
Browse files Browse the repository at this point in the history
  • Loading branch information
koenderks committed Feb 8, 2025
1 parent 2bdb9b6 commit c43a622
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
13 changes: 12 additions & 1 deletion R/auditCommonFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -2769,12 +2769,16 @@
table$dependOn(options = c(
"tableBookDist", "tableDescriptives", "tableSample",
"samplingChecked", "evaluationChecked", "display",
"values.audit", "ir", "irCustom", "cr", "crCustom", "car", "carCustom"
"values.audit", "ir", "irCustom", "cr", "crCustom", "car", "carCustom",
"overallMateriality", "overallMaterialityType", "overallMaterialityPercentage", "overallMaterialityAmount"
))

columnType <- if (options[["display"]] == "percent") "string" else "number"
table$addColumnInfo(name = "null", title = "", type = "string")
if (options[["materiality_test"]]) {
if (options[["workflow"]] && options[["overallMateriality"]]) {
table$addColumnInfo(name = "overall", title = gettext("Overall materiality"), type = columnType)
}
table$addColumnInfo(name = "materiality", title = gettext("Performance materiality"), type = columnType)
}
if (options[["min_precision_test"]]) {
Expand Down Expand Up @@ -2873,6 +2877,13 @@
"percent" = paste0(round(prevOptions[["materiality_val"]] * 100, 3), "%"),
"amount" = prevOptions[["materiality_val"]] * parentState[["N.units"]]
)
if (options[["workflow"]] && options[["overallMateriality"]]) {
table[["overall"]] <- switch(options[["display"]],
"number" = if (options[["overallMaterialityType"]] == "overallMaterialityAbsolute") options[["overallMaterialityAmount"]] / parentState[["N.units"]] else options[["overallMaterialityPercentage"]],
"percent" = if (options[["overallMaterialityType"]] == "overallMaterialityAbsolute") paste0(round(options[["overallMaterialityAmount"]] / parentState[["N.units"]] * 100, 3), "%") else paste0(round(options[["overallMaterialityPercentage"]] * 100, 3), "%"),
"amount" = if (options[["overallMaterialityType"]] == "overallMaterialityAbsolute") options[["overallMaterialityAmount"]] else options[["overallMaterialityPercentage"]] * parentState[["N.units"]]
)
}
}

if (options[["min_precision_test"]]) {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-auditbayesianworkflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ options$plotPriorPredictive <- FALSE
options$plotPosteriorPredictive <- FALSE
options$plotEstimates <- FALSE
options$tableCorrections <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- jaspTools::runAnalysis("auditBayesianWorkflow", "test-workflow.csv", options)

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-auditclassicalworkflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ options$tableAssumptions <- FALSE
options$plotEstimates <- FALSE
options$tableCorrections <- FALSE
options$plotErrorDist <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- jaspTools::runAnalysis("auditClassicalWorkflow", "test-workflow.csv", options)

Expand Down
14 changes: 14 additions & 0 deletions tests/testthat/test-uvb.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ options$indicator_col <- "SelectionResult"
options$variable_col <- "AuditResult"
options$annotation <- "continuous"
options$randomize <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- jaspTools::runAnalysis("auditBayesianWorkflow", "Case2.csv", options)

Expand Down Expand Up @@ -233,6 +235,8 @@ options$indicator_col <- "selected"
options$variable_col <- "auditResult"
options$annotation <- "continuous"
options$randomize <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- jaspTools::runAnalysis("auditBayesianWorkflow", "uvb-testcase1.csv", options)

Expand Down Expand Up @@ -354,6 +358,8 @@ options$indicator_col <- "selected"
options$variable_col <- "auditResult"
options$annotation <- "continuous"
options$randomize <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- runAnalysis("auditBayesianWorkflow", "uvb-testcase2.csv", options)

Expand Down Expand Up @@ -457,6 +463,8 @@ options$indicator_col <- "selected"
options$variable_col <- "auditResult"
options$annotation <- "continuous"
options$randomize <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- jaspTools::runAnalysis("auditBayesianWorkflow", "uvb-testcase3.csv", options)

Expand Down Expand Up @@ -576,6 +584,8 @@ options$indicator_col <- "selected"
options$variable_col <- "auditResult"
options$annotation <- "continuous"
options$randomize <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- jaspTools::runAnalysis("auditBayesianWorkflow", "uvb-testcase4.csv", options)

Expand Down Expand Up @@ -680,6 +690,8 @@ options$indicator_col <- "selected"
options$variable_col <- "auditResult"
options$annotation <- "continuous"
options$randomize <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- jaspTools::runAnalysis("auditBayesianWorkflow", "uvb-testcase5.csv", options)

Expand Down Expand Up @@ -789,6 +801,8 @@ options$indicator_col <- "selected"
options$variable_col <- "auditResult"
options$annotation <- "continuous"
options$randomize <- FALSE
options$workflow <- TRUE
options$overallMateriality <- FALSE
set.seed(1)
results <- jaspTools::runAnalysis("auditBayesianWorkflow", "uvb-testcase6.csv", options)

Expand Down

0 comments on commit c43a622

Please sign in to comment.