Repository navigation
Conversation
Offer an opt-in format_table argument to distinguish random-effect terms with identical labels. Keep the grouping column available for downstream table rendering. Refs easystats#406
|
This PR fixes #406. With |
| verbose = TRUE, | ||
| ... | ||
| ..., | ||
| group_in_parameter = FALSE |
There was a problem hiding this comment.
Please move group_in_parameter before verbose (verbose and ... should always be last arguments)
There was a problem hiding this comment.
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
4 open issues
Using!nzchar(..., keepNA = TRUE)can produceNAvalues in the logical index when the vector… · New Using!nzchar(..., keepNA = TRUE)can produceNAvalues in the logical index when the vector… · New Placinggroup_in_parameterafter...is unconventional in R APIs and prevents positional… · New The docstring impliesgroup_in_parametercauses the output to “include” a separateGroup… · New
1 file not reviewed
man/format_table.Rd: Generated file
What changed in this PR
Adds an opt-in group_in_parameter argument to format_table() so random-effect SD/Cor parameter labels can include their grouping factor, helping disambiguate duplicated labels in mixed models (Fixes #406).
Changes:
- Add
group_in_parameterargument and internal helper to append grouping factor to random-effectParameterlabels when applicable. - Add test coverage for grouped parameter labeling behavior and edge cases (missing
Group,Residualhandling). - Document the change in
NEWS.md.
| File | Description |
|---|---|
R/format_table.R |
Adds group_in_parameter arg and .format_parameter_groups() helper; tweaks df empty-string handling. |
tests/testthat/test-format_table_groups.R |
New tests validating grouped parameter labeling and edge cases. |
NEWS.md |
Notes new format_table(group_in_parameter = TRUE) behavior. |
Review effort: Lite
| if (stats %in% names(x) && "df" %in% names(x)) { | ||
| if (is.character(x$df)) { | ||
| x$df[x$df == ""] <- NA_character_ | ||
| x$df[!nzchar(x$df, keepNA = TRUE)] <- NA_character_ |
| } else if (stats %in% names(x) && "df_error" %in% names(x)) { | ||
| if (is.character(x$df_error)) { | ||
| x$df_error[x$df_error == ""] <- NA_character_ | ||
| x$df_error[!nzchar(x$df_error, keepNA = TRUE)] <- NA_character_ |
| x, | ||
| pretty_names = TRUE, | ||
| stars = FALSE, | ||
| stars_only = FALSE, | ||
| digits = 2, | ||
| ci_width = "auto", | ||
| ci_brackets = getOption("easystats_ci_brackets", TRUE), | ||
| ci_separator = getOption("easystats_ci_separator", ", "), | ||
| ci_digits = digits, | ||
| p_digits = 3, | ||
| rope_digits = digits, | ||
| ic_digits = 1, | ||
| zap_small = FALSE, | ||
| preserve_attributes = FALSE, | ||
| exact = TRUE, | ||
| use_symbols = getOption("insight_use_symbols", FALSE), | ||
| select = NULL, | ||
| verbose = TRUE, | ||
| ... | ||
| ..., | ||
| group_in_parameter = FALSE | ||
| ) { |
| #' @param group_in_parameter Logical. If `TRUE`, include the grouping factor in | ||
| #' the labels for random-effect standard deviations and correlations. The | ||
| #' result includes the separate `Group` column. |



Summary
Add
group_in_parameter = TRUEtoformat_table(). It distinguishes random-effect standard deviations and correlations that share a parameter label. The output includes a separateGroupcolumn.Fixes #406.
Validation
The mixed-model example from the issue produced distinct labels for both grouping factors. The installed regression passed all six assertions. The full Windows package check returned Status OK with 2,517 passing assertions. Air and changed-file lint passed.