rstudio/gt
View on GitHubCannot process empty grouped dataframes if process_md is TRUE
Open
#2,081 opened on Nov 14, 2025
Difficulty: [1] NoviceEffort: [2] MediumGood First IssuePriority: [2] MediumType: ☹︎ Bug
Description
Prework
- Read and agree to the code of conduct and contributing guidelines.
- If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
Description
If one expects some Markdown in the column that contains the row groups, the current workaround is to set process_md to TRUE.
If the dataframe is empty, this fails.
No issues with row names, or if process_md is FALSE.
Reproducible example
library(dplyr)
library(gt)
mtcars[0, ] |>
gt::gt(
groupname_col = "cyl",
process_md = TRUE
)
#> Error in `dplyr::recode()`:
#> ! No replacements provided.
mtcars[0, ] |>
dplyr::group_by(cyl) |>
gt::gt(
process_md = TRUE
)
#> Error in `dplyr::recode()`:
#> ! No replacements provided.
Expected result
An empty table.
No issues with row names or if Markdown processing is disabled:
mtcars[0, ] |>
gt::gt(
rowname_col = "cyl",
process_md = TRUE
)
mtcars[0, ] |>
gt::gt(
groupname_col = "cyl",
process_md = FALSE
)
mtcars[0, ] |>
gt::gt(
rowname_col = "cyl",
process_md = FALSE
)
These all produce an empty table:
Session info
Session info
sessionInfo()
#> R version 4.5.2 (2025-10-31 ucrt)
#> Platform: x86_64-w64-mingw32/x64
#> Running under: Windows 11 x64 (build 22631)
#>
#> Matrix products: default
#> LAPACK version 3.12.1
#>
#> locale:
#> [1] LC_COLLATE=English_Switzerland.utf8 LC_CTYPE=English_Switzerland.utf8
#> [3] LC_MONETARY=English_Switzerland.utf8 LC_NUMERIC=C
#> [5] LC_TIME=English_Switzerland.utf8
#>
#> time zone: Europe/Zurich
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] gt_1.1.0 dplyr_1.1.4
#>
#> loaded via a namespace (and not attached):
#> [1] digest_0.6.38 R6_2.6.1 fastmap_1.2.0 tidyselect_1.2.1
#> [5] xfun_0.54 magrittr_2.0.4 glue_1.8.0 tibble_3.3.0
#> [9] knitr_1.50 pkgconfig_2.0.3 htmltools_0.5.8.1 generics_0.1.4
#> [13] rmarkdown_2.30 lifecycle_1.0.4 xml2_1.4.1 cli_3.6.5
#> [17] vctrs_0.6.5 reprex_2.1.1 withr_3.0.2 compiler_4.5.2
#> [21] tools_4.5.2 pillar_1.11.1 evaluate_1.0.5 yaml_2.3.10
#> [25] rlang_1.1.6 fs_1.6.6