Skip to content

revise, readability#1225

Open
strengejacke wants to merge 12 commits into
mainfrom
revise_format_utils
Open

revise, readability#1225
strengejacke wants to merge 12 commits into
mainfrom
revise_format_utils

Conversation

@strengejacke
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread R/utils_format.R
Comment thread R/utils_format.R Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.R for readability (reorganizes globals, replaces conditional chains with switch(), and extracts component-header logic into helper functions).
  • Adjusts test dependencies/qualification (e.g., rstanarm::stan_glm(), WRS2) and adds a new lavaan::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.

Comment thread R/utils_format.R Outdated
Comment thread R/utils_format.R Outdated
strengejacke and others added 3 commits May 21, 2026 16:31
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants