-
Notifications
You must be signed in to change notification settings - Fork 0
⚡ Bolt: R 성능 최적화 (which.min 및 유니크 카운트) #298
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?
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 |
|---|---|---|
|
|
@@ -83,7 +83,7 @@ surveyFA <- function( | |
| response_data <- as.data.frame(data) | ||
| response_data <- | ||
| response_data[, vapply(response_data, function(column) { | ||
| nunique <- length(unique(stats::na.omit(column))) | ||
| nunique <- sum(!is.na(unique(column))) | ||
| nunique >= 2L | ||
| }, logical(1L))] | ||
|
|
||
|
|
@@ -232,7 +232,7 @@ surveyFA <- function( | |
| names(p_values) <- rownames(fit_df) | ||
| if (any(!is.na(p_values))) { | ||
| p_values[is.na(p_values)] <- 1 | ||
| candidate <- names(sort(p_values, decreasing = FALSE))[1L] | ||
| candidate <- names(which.min(p_values)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: which.min preserves sort()[1L] tie-breaking In Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| if (!is.na(candidate) && p_values[[candidate]] < pThreshold) { | ||
| return(candidate) | ||
| } | ||
|
|
||
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.
📝 Info: aFIPC unique-count refactor is numerically equivalent
The switch from
length(stats::na.omit(unique(x)))tosum(!is.na(unique(x)))yields the same distinct-non-NA count feeding the common-item equality check, so the guarded numerical behavior in aFIPC is preserved.Was this helpful? React with 👍 or 👎 to provide feedback.