问题
I used the rmarkdown to create a pdf file, where some tables are included in the output. The tables are created by using pander function.
As you see, the output does not wrap the text well, so the output is quite dirty.
Suppose the code is as follows:
title: "Untitled"
output: pdf_document
---
```{r kable}
library(xtable)
a <- rep(1,5)
b <- rep("33333333333333333333333333333333333333333333333333333333333333333", 5)
c <- rep("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", 5)
data <- as.data.frame( cbind(a, b, c) )
```
```{r b}
library(pander)
pander(data, split.cells = 5, split.table = Inf)
```
```{r c}
pander(data, split.cells = 5)
```
I do not know if there is any method to create pdf-format table that can wrap the text well.
I have tried the method in this link. wrap long text in kable table column But it fails.
来源:https://stackoverflow.com/questions/42568024/create-pdf-format-table-that-can-wrap-the-text-well-in-rmarkdown