-
Notifications
You must be signed in to change notification settings - Fork 20
Fix mg error #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix mg error #286
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -64,8 +64,7 @@ principalComponentAnalysisInternal <- function(jaspResults, dataset, options, .. | |||||||||||||
| dataset[] <- lapply(dataset, function(x) as.numeric(as.character(x))) # the psych-package wants data to be numeric | ||||||||||||||
| return(dataset) | ||||||||||||||
| } else { | ||||||||||||||
| dataset[] <- lapply(dataset, function(x) as.numeric(as.character(x))) | ||||||||||||||
| return(dataset) | ||||||||||||||
| return(.readDataSetToEnd(columns.as.numeric = unlist(options$variables))) | ||||||||||||||
|
||||||||||||||
| } | ||||||||||||||
| } else { # if variance covariance matrix as input | ||||||||||||||
| columnIndices <- sapply(options$variables, jaspBase:::columnIndexInData) + 1 # cpp starts at 0 | ||||||||||||||
|
|
@@ -90,19 +89,23 @@ principalComponentAnalysisInternal <- function(jaspResults, dataset, options, .. | |||||||||||||
| return(dataset) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| # it seems the column names are sorted alphabetically when all columns are read | ||||||||||||||
| # so we need to sort the column names to match the order of the variables | ||||||||||||||
| sortedIndices <- sort(as.numeric(gsub(".*_(\\d+)_.*", "\\1", colnames(dataset)))) | ||||||||||||||
| sortedNames <- paste0("JaspColumn_", sortedIndices, "_Encoded") | ||||||||||||||
| dataset <- dataset[, sortedNames] | ||||||||||||||
|
Comment on lines
+92
to
+96
|
||||||||||||||
| # it seems the column names are sorted alphabetically when all columns are read | |
| # so we need to sort the column names to match the order of the variables | |
| sortedIndices <- sort(as.numeric(gsub(".*_(\\d+)_.*", "\\1", colnames(dataset)))) | |
| sortedNames <- paste0("JaspColumn_", sortedIndices, "_Encoded") | |
| dataset <- dataset[, sortedNames] | |
| dataset <- .sortDatasetColumns(dataset, options$variables) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code is already in a common function shared between PCA and EFA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The condition has been expanded to include group analysis. Consider adding a comment explaining why intercepts are needed when group analysis is performed, as this may not be immediately obvious to future maintainers.