rstudio / gt

Easily generate information-rich, publication-quality tables from R
https://gt.rstudio.com
Other
1.98k stars 199 forks source link

spanner heights is not the same for all spanners #1477

Open olivroy opened 10 months ago

olivroy commented 10 months ago

The spanner height doesn't seem respected.

gt::gt(
  data = structure(list(
    FEATURES = c(
      "Gene1", "Gene2", "Gene3", "Gene4",
      "Gene5"
    ), CONTRASTS = c(
      "condition: 1 vs. 0", "condition: 1 vs. 0",
      "condition: 1 vs. 0", "condition: 1 vs. 0", "condition: 1 vs. 0"
    ), LIMMA.ESTIMATE = c(
      0.325357591624977, 0.294376649868767,
      -0.372112777793342, -0.47107999497371, -0.0933117711552145
    ),
    LIMMA.P_VALUE = c(
      3.06628859857087e-06, 2.8253129711711e-06,
      0.000419232793116877, 0.00199991913409095, 0.0350903776632474
    ),
    LIMMAS.ESTIMATE = c(
      0.325357591624977, 0.294376649868767,
      -0.372112777793342, -0.47107999497371, -0.0933117711552145
    ),
    LIMMAS.P_VALUE = c(
      3.06628859857087e-06, 2.8253129711711e-06,
      0.000419232793116877, 0.00199991913409095, 0.0350903776632474
    ),
    `VERY VERY VERY LONG COUNTS.MEAN` = c(
      21433.0459458001, 21664.5137266682, 22887.6046442154,
      19977.4641196898, 14634.8752065793
    ), `VERY VERY VERY LONG COUNTS.SD` = c(
      8287.40744333268,
      7589.84039964603, 10130.2519032155, 10677.3719374534, 2578.44599379548
    )
  ), row.names = c(NA, 5L), class = c("data.frame"))
) |>
  gt::tab_spanner_delim(
    delim = ".",
    columns = dplyr::matches("DESEQ2.|LIMMA.|GLMM.|COUNTS.|ES.|LM.|LIMMAS."),
    split = "last"
  )

image

I would expect all spanner lines to be the same height. (Edit: this was an issue in gt 0.9.0)

Originally posted by @olivroy in https://github.com/rstudio/gt/issues/1469#issuecomment-1786007565

rich-iannone commented 3 months ago

I admit that I don’t know yet how to solve this issue but it does seem possible and desirable to solve given what I’ve seen other table generation packages can do.