使用 gt 编织为 pdf 时在表格中换行文本

ran*_*ber 8 r-markdown gt

抱歉,如果这是一个非常微不足道的问题,但我在互联网上查找并找不到答案。我正在使用 markdown 中的 gt 包制作一个基本表格。但在编织到 *.pdf 时,我似乎无法让文本换行。任何帮助将不胜感激!

table_data %>% gt()
Run Code Online (Sandbox Code Playgroud)

Mar*_*Mar 6

不是答案,而是一个可重现的工作示例。

---
title: "Test"
output: pdf_document
---

```{r test, echo=FALSE, warning = FALSE}
library(tidyverse)
library(gt)

test <- data.frame(v1=c(
  "This is a long string. This is a long string. This is a long string. This is a long string. This is a long string.",
  "This is a another long string. This is a another long string. This is a another long string. This is a another long string. This is a another long string."),
                   v2=c(1, 2))
test %>% gt()
```
Run Code Online (Sandbox Code Playgroud)

结果是:

在此输入图像描述

我最终还是选择了kableExtra。使用可重现的工作示例,替换test %>% gt()test %>% kable() %>% kable_styling(full_width = TRUE)