我正在尝试使用文档中的gtsummary
表格papaja::apa6_pdf
来包含格式化(带标题)kable
表格。但是,它没有按预期呈现。相比之下,gtsummary
kable
表格在正常情况下呈现得很好rmarkdown::pdf_document
(尽管gtsummary
kableExtra
表格看起来也不是很好)。我将不胜感激有关如何获得gtsummary
并papaja
共同发挥以产生“漂亮” PDF 表格的任何建议。谢谢!
rmarkdown::pdf_document
```
---
title: "gtsummary + rmarkdown::pdf_document"
output: pdf_document
---
```
```{r}
library(gtsummary)
trial %>%
tbl_summary(by = trt) %>%
modify_caption("This is a table about trials") %>%
as_kable()
trial %>%
tbl_summary(by = trt) %>%
modify_caption("This is another table about trials") %>%
as_kable_extra()
```
papaja::apa6_pdf
```
---
title : "gtsummary + papaja"
shorttitle : "gtsummary + papaja"
author:
- name : "First Author"
affiliation : "1"
corresponding : yes # Define only one corresponding author
address : "Postal address"
email : "my@email.com"
affiliation:
- id : "1"
institution : "Wilhelm-Wundt-University"
authornote: >
abstract: "my abstract"
keywords : "keywords"
wordcount : "X"
bibliography : []
floatsintext : no
figurelist : no
tablelist : no
footnotelist : no
linenumbers : yes
mask : no
draft : no
documentclass : "apa6"
classoption : "man"
output : papaja::apa6_pdf
---
```{r}
library(papaja)
library(gtsummary)
trial %>%
tbl_summary(by = trt) %>%
modify_caption("This is a table about trials") %>%
as_kable()
trial %>%
tbl_summary(by = trt) %>%
modify_caption("This is another table about trials") %>%
as_kable_extra()
```