⚡ Bolt: Replace multiple grep() calls with single !grepl()#112
⚡ Bolt: Replace multiple grep() calls with single !grepl()#112seonghobae wants to merge 1 commit into
Conversation
…cal match
- I have replaced multiple negative search index outputs with a single logical match in `R/aFIPC.R`.
- Combining multiple negative search outputs (e.g., `x[-c(find_index("A", x), find_index("B", x))]`) is inefficient and unsafe in base R. If no patterns match, it evaluates to `x[-integer(0)]` which unexpectedly returns `character(0)`, wiping out the entire vector.
- Executing multiple search calls is computationally more expensive than a single logical evaluation.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What
R/aFIPC.R에서 복수의 부정grep()호출을 단일!grepl()로 교체했습니다.🎯 Why
base R에서 여러 개의 부정
grep()출력을 결합하는 것(예:x[-c(grep("A", x), grep("B", x))])은 비효율적일 뿐만 아니라 안전하지 않습니다. 어떤 패턴도 일치하지 않는 경우x[-integer(0)]으로 평가되어 기대와 달리character(0)을 반환하여 전체 벡터를 지워버립니다.추가로 여러 번의
grep호출은 한 번의grepl호출보다 연산 비용이 더 많이 듭니다.📊 Impact
🔬 Measurement
테스트 스위트를 실행하여 변경 사항이 의도대로 동작하며 버그를 유발하지 않음을 검증했습니다. (
Rscript -e "testthat::test_dir('tests/testthat')").PR created automatically by Jules for task 8016841973574737239 started by @seonghobae