revise, readability#1225
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors R/utils_format.R to improve code readability and efficiency, notably by replacing nested conditionals with switch() and optimizing row insertion in .add_obs_row. Review feedback identifies a typo in the 'Auxiliary' parameter string and points out that the pre-allocation of final_table is ineffective when using named assignments, suggesting a simpler list initialization instead.
There was a problem hiding this comment.
Pull request overview
This PR focuses on readability-oriented refactoring of the table-formatting utilities and updates/extends the Discovr book regression tests to cover additional SEM output.
Changes:
- Refactors
R/utils_format.Rfor readability (reorganizes globals, replaces conditional chains withswitch(), and extracts component-header logic into helper functions). - Adjusts test dependencies/qualification (e.g.,
rstanarm::stan_glm(),WRS2) and adds a newlavaan::sem()test case for chapter 10.4 output formatting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/testthat/test-discovr_book.R | Fixes/clarifies test dependencies and adds SEM (lavaan) output coverage. |
| R/utils_format.R | Large readability refactor of formatting helpers and component header generation logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
No description provided.