Fix custom effect size rules not being correctly reported as custom rules #511
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Custom effect size rules were not being properly reported as such, showing malformed text with a blank space instead of indicating they were custom rules.
Issue
When using custom rules with
effectsize::rules(), the report output would show:Notice the blank space between "following" and "recommendations."
Root Cause
The
.text_effectsize()function inR/report_effectsize.Rused aswitch()statement to map known rule names like "cohen1988", "gignac2016", etc. When custom rules with unknown names (like "Unknown") were passed, the switch returnedNULLforeffsize_name, resulting in the malformed text.Solution
Modified the logic in
.text_effectsize()to check if the rule name is recognized. If theswitch()statement returnsNULL(indicating an unknown rule name), the function now correctly identifies it as a custom rule.Before and After
Before:
After:
Testing
.text_effectsize()covering all predefined rules and custom rule scenariosFixes #458.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.