保持从`gtsummary`到`gt`的缩进?

问题描述 投票:0回答:1

我想将我的

gtsummary
表格转换为
gt
表格,并最终转换为乳胶,同时仍保持缩进。保持压痕的简单方法是什么?

library(gtsummary)
library(gt)
    trial[c("trt", "age", "response", "grade")] %>%
    tbl_summary(by = trt) %>%
    as_gt() |> 
    as_latex() |> 
    as.character() |> 
    cat()

输出:

\setlength{\LTpost}{0mm}
\begin{longtable}{lcc}
\toprule
\textbf{Characteristic} & \textbf{Drug A}, N = 98\textsuperscript{\textit{1}} & \textbf{Drug B}, N = 102\textsuperscript{\textit{1}} \\ 
\midrule
Age & 46 (37, 59) & 48 (39, 56) \\ 
    Unknown & 7 & 4 \\ 
Tumor Response & 28 (29\%) & 33 (34\%) \\ 
    Unknown & 3 & 4 \\ 
Grade &  &  \\ 
    I & 35 (36\%) & 33 (32\%) \\ 
    II & 32 (33\%) & 36 (35\%) \\ 
    III & 31 (32\%) & 33 (32\%) \\ 
\bottomrule
\end{longtable}
\begin{minipage}{\linewidth}
\textsuperscript{\textit{1}}Median (IQR); n (\%)\\
\end{minipage}
r latex gtsummary gt
1个回答
0
投票

您可以通过在四开或 rmarkdown 文档中创建表格来避免转换为原始乳胶。

© www.soinside.com 2019 - 2024. All rights reserved.