Skip to content

Commit

Permalink
Fixed the bug with NAs at aggregation, table headers for the Repeated…
Browse files Browse the repository at this point in the history
… Measures levels and the spelling of the Create-button
  • Loading branch information
sjentsch committed Apr 5, 2024
1 parent 575ec3a commit e31be98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions R/globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fmtAdR <- "There are %d more rows in the data set not shown here."
fmtFsC <- "The column%s %s %s shown first in this preview. In the created data set, the variable order is as shown in \"Variables in the Output Data Set\" above this table."

# help messages
hlpCrt <- paste("<strong>\"CREATE\" opens the modified data set</strong> in a new jamovi window.")
hlpCrt <- paste("Pressing the <strong>\"Create\"-button opens the modified data set</strong> in a new jamovi window.")

hlpArC <- paste("Please assign the variables in their desired order to \"Desired Order of Variables\". By ticking \"Add Remaining Variables at the",
"End\", variables that are not contained in \"Desired order of variables\") are appended.")
Expand Down Expand Up @@ -163,4 +163,5 @@ dtlNSA <- c(paste("\"Variables That Identify the Same Unit\" is an ID variable (
"followed by rspCrr_cong_GREEN_2), and you should thus set the name of the index variable to \"rep\" and the \"N levels\" to two (1 and 2).",
"Once you did all this, and the number of variables in the variable lists for the long variables under \"Variables To Be Transformed\" - 24 -",
"matches up with the product of \"N levels\" - 3 (cond) * 4 (colour) * 2 = 24 - a \"Data Preview\" and an overview over the \"Repeated-Measures",
"Levels\" is shown, and you can open the transformed data set (after checking those tables) in a new jamovi window by pressing \"CREATE\"."))
"Levels\" is shown, and you can open the transformed data set (after checking those tables) in a new jamovi window by pressing the",
"\"Create\"-button."))
4 changes: 2 additions & 2 deletions R/jtlong2wide.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ jtLong2WideClass <- if (requireNamespace("jmvcore", quietly = TRUE)) R6::R6Class
varTme <- self$options$varTme
numTme <- length(varTme)
if (!is.null(self$data) && dim(self$data)[1] > 0) orgDta <- self$data else orgDta <- self$readDataset()
tblFrq <- as.data.frame(table(orgDta[, varTme[seq(numTme, 1)]]))[, seq(numTme + 1, 1)]
tblFrq <- as.data.frame(table(orgDta[, varTme[seq(numTme, 1)], drop = FALSE]))[, seq(numTme + 1, 1)]
varTgt <- sort(self$options$varTgt)
nmeTgt <- sort(names(xfmDta)[grepl(paste0(paste0("^", varTgt), collapse = "|"), names(xfmDta))])
nmeTgt <- as.data.frame(apply(matrix(nmeTgt, ncol = length(varTgt), dimnames = list(c(), varTgt)), 2, sort), row.names = NULL)
cbind(tblFrq[, -1], nmeTgt, tblFrq[, 1])
cbind(tblFrq[, -1, drop = FALSE], nmeTgt, tblFrq[, 1, drop = FALSE])
}

),
Expand Down

0 comments on commit e31be98

Please sign in to comment.