抱歉,如果这是一个非常微不足道的问题,但我在互联网上查找并找不到答案。我正在使用 markdown 中的 gt 包制作一个基本表格。但在编织到 *.pdf 时,我似乎无法让文本换行。任何帮助将不胜感激!
table_data %>% gt()
Run Code Online (Sandbox Code Playgroud)
不是答案,而是一个可重现的工作示例。
---
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)
| 归档时间: |
|
| 查看次数: |
442 次 |
| 最近记录: |