Skip to content

Commit

Permalink
Update auditCommonFunctions.R
Browse files Browse the repository at this point in the history
  • Loading branch information
koenderks committed Oct 10, 2024
1 parent 530b47d commit 60e01a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions R/auditCommonFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,29 @@
#####################################

.jfaExecutionStage <- function(options, jaspResults) {
if (options[["pasteVariables"]]) {
# Add the two computed colums to the data set
planningOptions <- .jfaInputOptionsGather(options, dataset = NULL, jaspResults, stage = "planning", rawData = TRUE)
if (is.null(jaspResults[["indicator_col"]])) {
jaspResults[["indicator_col"]] <- createJaspColumn(columnName = options[["indicator_col"]], dependencies = "indicator_col")
}
if (options[["executionChecked"]]) {
selectionState <- .jfaSelectionState(options, dataset, jaspResults[["planningState"]], jaspResults[["selectionContainer"]])

sample <- selectionState[["sample"]]
dataset <- .readDataSetToEnd(columns.as.numeric = options[["id"]])
sampleFilter <- numeric(selectionState[["N.items"]])
rowNumber <- as.numeric(sample[["row"]])
sampleFilter[rowNumber] <- as.numeric(sample[["times"]])

if (is.null(jaspResults[["indicator_col"]])) {
jaspResults[["indicator_col"]] <- createJaspColumn(columnName = options[["indicator_col"]], dependencies = "indicator_col")
}

jaspResults[["indicator_col"]]$setOrdinal(sampleFilter)
if (options[["annotation"]] == "binary") { # Overwrite the empty column with 0's
auditDataVariable <- rep(NA, selectionState[["N.items"]])
if (is.null(jaspResults[["variable_col"]])) {
auditDataVariable[rowNumber] <- 0
} else {
auditDataVariable[options[["performAudit"]][[1]]$rowIndices] <- base::pmin(options[["performAudit"]][[1]]$values, 1)
}
if (options[["pasteVariables"]]) {
jaspResults[["variable_col"]] <- createJaspColumn(columnName = options[["variable_col"]], dependencies = "variable_col")
jaspResults[["variable_col"]]$setScale(auditDataVariable)
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion inst/Description.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Description
author : "Koen Derks, Jacques de Swart, Eric-Jan Wagenmakers, Jan Wille and Ruud Wetzels"
maintainer : "Koen Derks <[email protected]>"
website : "www.github.com/koenderks/jfa"
preloadData : false
preloadData : false
license : "GPL (>= 3)"
icon : "audit-module.svg"

Expand Down

0 comments on commit 60e01a0

Please sign in to comment.