insightsengineering / insightsengineering/crane
Error when using tbl_roche_summary + add_stat_label(location = "column")
- Dominant language
- R
- Stars
- 15
- Forks
- 7
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 5
Description
I was using `tbl_roche_summary()` with some functions from `gtsummary` when I realized the problem is somehow on the crane function. See below how with `tbl_roche_summary()` does not end on the same result as with `tbl_summary()`:
``` r
ADSL <- teal.modules.clinical::tmc_ex_adsl
#> Registered S3 method overwritten by 'teal':
#> method from
#> c.teal_slices teal.slice
#> Registered S3 method overwritten by 'tern':
#> method from
#> tidy.glm broom
crane::tbl_roche_summary(data = ADSL, by = "SEX", include = "ACTARM") |>
gtsummary::add_stat_label(location = "column") |>
gtsummary::as_kable()
#> Error in `dplyr::mutate()`:
#> ℹ In argument: `stat_label = glue::glue_data(...)`.
#> Caused by error:
#> ! `stat_label` must be size 1, not 0.
gtsummary::tbl_summary(data = ADSL, by = "SEX", include = "ACTARM") |>
gtsummary::add_stat_label(location = "column") |>
gtsummary::as_kable()
```
| **Characteristic** | **Statistic** | **F** N = 110 | **M** N = 90 |
|:--------------------------|:-------------:|:-------------:|:------------:|
| Description of Actual Arm | | | |
| A: Drug X | n (%) | 38 (35%) | 31 (34%) |
| B: Placebo | n (%) | 40 (36%) | 33 (37%) |
| C: Combination | n (%) | 32 (29%) | 26 (29%) |
Created on 2026-02-17 with [reprex v2.1.1](https://reprex.tidyverse.org)
The `location = "row"` variant works without any issue.
I think some internal information that is generated with `tbl_summary()` is not generated or removed with `tbl_roche_summary()` as I think I saw it working with other variables/columns.
Contributor guide
Assessment
This issue has not been assessed yet.