Skip to content

format_table(): show the CI level in the column name for select - #1306

Merged
strengejacke merged 3 commits into
mainfrom
hotfix-ci-level-header
Nov 3, 2026
Merged

strengejacke merged 3 commits into
mainfrom
hotfix-ci-level-header

Conversation

@jmgirard

@jmgirard jmgirard commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #1300

format_table() with select = "ci" or a {ci} pattern always wrote "CI" in the column name, although the CI column's name already holds the level. The column name now uses that name, so print(x, select = "ci") and print(x, select = "{estimate} ({ci})") both show Coefficient (95% CI). If the level isn't known (a plain CI or conf.int column), the name stays CI.

With two levels, select = "ci" still shows only the first one, as it did before. The column name now says which one it is, for example Coefficient (80% CI).

This changes expected output in two other packages, and those tests need updating once this is merged:

  • parameters: 5 tables in _snaps/compare_parameters.md and 3 [CI] headers in the "select pattern" test in test-printing.R
  • modelbased: 3 tables in _snaps/print.md (test-print.R only runs on Windows)

Only the header lines and the column widths change. I ran the parameters, modelbased and report tests against this branch, and report isn't affected.

@jmgirard
jmgirard requested a lite review from Copilot November 3, 2026 15:05
Comment thread DESCRIPTION Outdated
Package: insight
Title: Easy Access to Model Information for Various Model Objects
Version: 1.7.0
Version: 1.7.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's a bit high ;-)
Increase / add at fourth digit: 1.7.0.1

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues
What changed in this PR

Updates format_table() so CI selections/patterns reflect the CI level in the rendered column header (e.g., Coefficient (95% CI)), and adjusts tests/docs accordingly.

Changes:

  • Pass CI column name(s) into the glue/pattern naming helper so {ci} can render with the appropriate level.
  • Update existing test expectations and add new tests covering CI-level header behavior (including multi-level and unknown-level cases).
  • Document the change and bump package version.
File Description
tests/​testthat/​test-format_table_ci.R Adds new tests asserting CI level appears in column headers for select = "ci" and {ci} patterns.
tests/​testthat/​test-format_table.R Updates snapshot expectations for CI column headers to include 95% where applicable.
R/​format_table_glue.R Extends .style_pattern_to_name() to use CI column name (with level) when replacing {ci}.
NEWS.md Documents updated header behavior for CI selections/patterns.
DESCRIPTION Bumps package version to 1.7.0.1.

Review effort: Lite

Comment thread NEWS.md Resolved
Comment thread R/format_table_glue.R Resolved
@jmgirard

jmgirard commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

I went through Copilot's review and left both notes as they are. The (devel) NEWS heading is how this package labels unreleased changes, so it stays even with 1.7.0.1 in DESCRIPTION. The other note asks to accept CI names like 95%CI or 95% CI (HPD), but .format_glue_table() only treats a column as a CI column if its name ends in CI, is CI or is conf.int, so those names never reach the new code.

@strengejacke
strengejacke merged commit f507d2c into main Nov 3, 2026
11 of 20 checks passed
@strengejacke
strengejacke deleted the hotfix-ci-level-header branch November 3, 2026 17:59
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.

print with select="minimal" states the ci conf level (95% CI) but select="ci" or anything with {ci} does not, just "CI"

3 participants