gt icon indicating copy to clipboard operation
gt copied to clipboard

Fix empty dataframe error with process_md = TRUE

Open Copilot opened this issue 2 months ago • 1 comments

Summary

Fixes dplyr::recode() error when passing empty dataframes to gt() with groupname_col and process_md = TRUE.

Related GitHub Issues and PRs

  • Ref: #2081

Changes

R/dt_stub_df.R

  • Added guard clause to skip dplyr::recode() when unique_row_group_ids is empty (5 lines)

tests/testthat/test-gt_object.R

  • Added 5 test cases covering empty/non-empty dataframes with process_md combinations

Example

# Previously threw: Error in `dplyr::recode()`: ! No replacements provided.
mtcars[0, ] |> gt(groupname_col = "cyl", process_md = TRUE)

# Now works correctly, returns empty gt_tbl

Checklist

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.r-project.org
    • Triggering command: /usr/lib/R/bin/exec/R -e install.packages(c('devtools',~+~'testthat'),~+~repos='REDACTED',~+~Ncpus~+~=~+~4) (dns block)
    • Triggering command: /usr/lib/R/bin/exec/R -e devtools::install_deps(dependencies~+~=~+~TRUE) (dns block)
  • cran.rstudio.com
    • Triggering command: /usr/lib/R/bin/exec/R -e install.packages('remotes',~+~repos='REDACTED') (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Amongst all the issues, could you identify ones that would require quick fixes?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Nov 15 '25 07:11 Copilot

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: rich-iannone
:x: Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Nov 17 '25 06:11 CLAassistant