insightsengineering / insightsengineering/crane

ARD with duplicate stat names + updates to `tbl_ard_wide_summary()`

Open
#292 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
R
Stars
15
Forks
7
Avg merge
6d 9h
Merged PRs (30d)
5

Description

In the released version of gtsummary, if an ARD is passed to `tbl_ard_wide_summary()` that has duplicate stat names the function silently picks one of them (I can't recall if it's the first or last). This really is an error in the ARD preparation, and it should have never silently picked a stat without informing the user.

I noticed that in `tbl_roche_subgroups()` for time to event summaries, the ARD that is passed to `tbl_ard_wide_summary()` has duplicate `N` statistics. In the current dev version of gtsummary, both statistics will be shown instead of silently picking one. I plan to release this version of gtsummary to CRAN after CRAN's summer break.

```
# An ARD data frame: 4 × 9
variable context stat_name stat_label stat fmt_fun warning error variable_level

1 time continuous N n 5 0
2 time continuous median median 9.03 1
3 time tabulate_value n Events 3 0 1
4 time tabulate_value N N 5 0 1
```

Contributor guide

Open the contributing guide

Research direction

Start by locating tbl_ard_wide_summary() and the tests covering ARD stat_name handling. Reproduce the supplied four-row ARD with duplicate N names, then verify that both statistics are shown rather than one being silently discarded. Done means the behavior is covered by regression tests and the function no longer silently selects a duplicate statistic.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.