最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is there a way to indent wrapped lines of a long factor label in gtsummary? - Stack Overflow

programmeradmin4浏览0评论

Is there a way of indenting the 2nd+ lines of a long factor label in gtsummary, see the repex using tbl_summary below for what I mean

library(tidyverse)
library(haven)
library(gtsummary)

df <- tibble(x = c(1:2))

df <- df |>
  mutate(x = haven::labelled(x = x,
                             labels = c("A short label" = 1,
                                        "A much much much much much much much much much much much much much much much much much longer label" = 2),
                             label = "Can we indent wrapped labels?"),
         x = haven::as_factor(x))

tbl_summary(df) |> 
  modify_column_indent(columns = "label",
                       rows = !row_type %in% 'label',
                       indent = 8)

It looks fine without in html output, but I'm exporting using as_kable_extra() to LaTeX and it would really make my table easier to read

发布评论

评论列表(0)

  1. 暂无评论