-
Notifications
You must be signed in to change notification settings - Fork 0
⚡ Bolt: surveyFA 데이터 탐색 및 타입 변환 루프 병목 최적화 #419
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,9 +83,10 @@ 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 >= 2L | ||
| }, logical(1L))] | ||
| col <- column[!is.na(column)] | ||
| if (length(col) == 0L) return(FALSE) | ||
| any(col != col[1L]) | ||
| }, logical(1L)), drop = FALSE] | ||
|
|
||
| if (nrow(response_data) == 0L || ncol(response_data) < 2L) { | ||
| stop("surveyFA needs at least two non-constant response columns.", call. = FALSE) | ||
|
|
@@ -241,7 +242,7 @@ surveyFA <- function( | |
|
|
||
| v <- vapply( | ||
| response_data[active], | ||
| function(x) stats::var(as.numeric(x), na.rm = TRUE), | ||
| function(x) stats::var(x, na.rm = TRUE), | ||
|
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. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: git diff --unified=25 f87c2324f1686135e57d8730c1b0b9420874f300 5cd73869f22351f8856d88ff8ecf5078eaeee9e7 -- R/surveyFA.R .jules/bolt.md
rg -n 'surveyFA|numeric|factor|response' R tests NAMESPACE DESCRIPTION .julesRepository: ContextualWisdomLab/aFIPC Length of output: 12296 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- R/surveyFA.R lines 1-120 ---'
cat -n R/surveyFA.R | sed -n '1,120p'
printf '%s\n' '--- tests/testthat/test-surveyFA.R ---'
cat -n tests/testthat/test-surveyFA.R | sed -n '1,130p'
printf '%s\n' '--- surveyFA callers in R/aFIPC.R ---'
rg -n -A18 -B8 'surveyFA\(' R/aFIPC.R
printf '%s\n' '--- repository docs mentioning surveyFA input ---'
rg -n -i -A8 -B4 'surveyFA|response matrix|response data|data frame|numeric' README* vignettes man R DESCRIPTION 2>/dev/null || trueRepository: ContextualWisdomLab/aFIPC Length of output: 24902 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- autoFIPC input documentation and validation ---'
cat -n R/aFIPC.R | sed -n '1,180p'
printf '%s\n' '--- autoFIPC data assignments and mirt calls ---'
rg -n -A10 -B8 'oldformYData|newformXData|mirt::mirt|is\.numeric|is\.factor|as\.numeric' R/aFIPC.R
printf '%s\n' '--- tracked mirt/package contract sources ---'
git ls-files | rg -i '(^|/)(mirt|.*mirt.*|DESCRIPTION|NAMESPACE|README|surveyFA)' | head -80
rg -n -i -A6 -B6 'mirt.*data|data.*mirt|factor|numeric|response' DESCRIPTION README.md man R tests packrat 2>/dev/null | head -240Repository: ContextualWisdomLab/aFIPC Length of output: 42420 PR 요약에 numeric 입력 전제를 명시하세요. 분산 fallback은 🤖 Prompt for AI Agents |
||
| numeric(1L) | ||
| ) | ||
| names(v) <- active | ||
|
|
||
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
any()설명에서 조기 종료 주장을 바로잡으세요.R은
col != col[1L]비교식의 결과인 논리 벡터를 만든 뒤any()가 그 벡터를 검사합니다. 따라서 비교 연산은 컬럼 전체를 처리하며, 현재 “Early-exit” 설명은 비교 작업도 조기에 멈춘다고 오해하게 합니다. (stat.ethz.ch)unique()결과 생성과 중복 제거 작업을 줄인다는 설명으로 바꾸세요.수정 예시
📝 Committable suggestion
🤖 Prompt for AI Agents