Skip to content

Commit

Permalink
Fix inconsistent standard names in R vs QML
Browse files Browse the repository at this point in the history
  • Loading branch information
JTPetter committed Sep 4, 2024
1 parent f088938 commit bde3806
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
26 changes: 23 additions & 3 deletions inst/qml/doeFactorial.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,32 @@ Form
itemType : JASP.String

function getColHeaderText(headerText, colIndex) { return colIndex === 0 ? qsTr("Name") : qsTr("Level %1").arg(colIndex); }
function getRowHeaderText(headerText, rowIndex) { return String.fromCharCode(65 + rowIndex); }
function getRowHeaderText(headerText, rowIndex) {
// skipping letter I, as the R package does this for internal naming convention. Also continuing with lowercase afterwards and skipping letter i.
if (rowIndex < 8) {
return String.fromCharCode(65 + rowIndex);
} else if (rowIndex > 7 & rowIndex < 25) {
return String.fromCharCode(65 + rowIndex + 1);
} else if (rowIndex > 24 & rowIndex < 33) {
return String.fromCharCode(65 + rowIndex + 7);
} else if (rowIndex > 32) {
return String.fromCharCode(65 + rowIndex + 8);
}
}
function getDefaultValue(columnIndex, rowIndex) {
if (columnIndex > 2) {
return ""; // Return an empty string for columnIndex > 2
} else if (columnIndex === 0) {
return String.fromCharCode(65 + rowIndex); // Uppercase letter for columnIndex 0
} else if (columnIndex === 0) { // Starting with uppercase letter for columnIndex 0 (Predictor Names)
// skipping letter I, as the R package does this for internal naming convention. Also continuing with lowercase afterwards and skipping letter i.
if (rowIndex < 8) {
return String.fromCharCode(65 + rowIndex);
} else if (rowIndex > 7 & rowIndex < 25) {
return String.fromCharCode(65 + rowIndex + 1);
} else if (rowIndex > 24 & rowIndex < 33) {
return String.fromCharCode(65 + rowIndex + 7);
} else if (rowIndex > 32) {
return String.fromCharCode(65 + rowIndex + 8);
}
} else {
return String.fromCharCode(97 + columnIndex - 1); // Lowercase letter otherwise
}
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-doeFactorial.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ options$categoricalVariables <- list(
list(
levels = c("Row 0", "Row 1", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6", "Row 7", "Row 8"),
name = "data 1",
values = c("A", "B", "C", "D", "E", "F", "G", "H", "I")
values = c("A", "B", "C", "D", "E", "F", "G", "H", "J")
),
list(
levels = c("Row 0", "Row 1", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6", "Row 7", "Row 8"),
Expand Down Expand Up @@ -264,7 +264,7 @@ options$categoricalVariables <- list(
list(
levels = c("Row 0", "Row 1", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6", "Row 7", "Row 8"),
name = "data 1",
values = c("A", "B", "C", "D", "E", "F", "G", "H", "I")
values = c("A", "B", "C", "D", "E", "F", "G", "H", "J")
),
list(
levels = c("Row 0", "Row 1", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6", "Row 7", "Row 8"),
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-msaAttribute.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ options$fleissKappa <- TRUE
options$cohensKappa <- TRUE
options$positiveReference <- ""
options$kendallsTau <- TRUE
results <- runAnalysis("msaAttribute", "datasets/msaAttributeAgreement/msaAttributeTau_long.csv", options, makeTests = T)
results <- runAnalysis("msaAttribute", "datasets/msaAttributeAgreement/msaAttributeTau_long.csv", options)

test_that("LF2.1 Kendall Tau - All appraisers vs standard table results match", {
table <- results[["results"]][["AAAtableGraphs"]][["collection"]][["AAAtableGraphs_AllVsStandard"]][["data"]]
Expand Down

0 comments on commit bde3806

Please sign in to comment.