ddsjoberg / gtsummary

Presentation-Ready Data Summary and Analytic Result Tables
http://www.danieldsjoberg.com/gtsummary
Other
1.04k stars 116 forks source link

Bug Report: as_hux_xlsx fails to indent row w/ numeric value #1386

Closed shannonpileggi closed 1 year ago

shannonpileggi commented 1 year ago

Levels that only have numbers in them do not indent with the as_hux_xlsx() export.

library(gtsummary)
library(dplyr)
library(huxtable)

t1 <- trial |> 
  mutate(
    age_category = case_when(
      is.na(age) ~ NA_character_,
      age == 6 ~ "6",
      age > 6 ~ "7 - 83")
  ) |> 
  select(trt, age_category, response) |> 
  tbl_summary()

t1

image

as_hux_xlsx(t1, "table1.xlsx")

image

I haven't been able to get a reprex together yet to see if quick_xlsx() produces the same result, but I can keep working on that.

ddsjoberg commented 1 year ago

FYI, this occurs with a data frame passed directly to huxtable::quick_xlxs() as well.

ddsjoberg commented 1 year ago

@shannonpileggi we can either transfer the issue to huxtable, or experiment with some non-breaking unicode spaces and see if that can solve the issue