ddsjoberg/gtsummary

Bug Report: Labels are lost in tbl_summary when the variable used in `by=` contains missing values

Closed this issue · 1 comments

Dear @ddsjoberg,

With the latest version of {gtsummary} available in CRAN, when I use tbl_summary() with a variable specified in the by= argument that contains any missing value, no labels are printed in the resulting table. Here is a reproducible example using the built-in dataset. The problem seems to occur only when the dataset is of the data.frame class.

library(gtsummary)

trial |> 
  as.data.frame() |> 
  tbl_summary(
    by = response
  )

Thank you very much for this amazing package!

Thanks for reporting @pasahe !

I didn't appreciate the differential between tibbles and data frames on losing the label attribute and hadn't tested that situation.