如何在Rmarkdown中旋转或调整大表?

时间:2016-11-10 13:08:17

标签: r-markdown

以下是我的例子:

---
title: "There is a reproductible example"
output: pdf_document
---

```{r table-simple, echo=FALSE, message=FALSE, warnings=FALSE, results='asis'}
require(pander)
panderOptions('table.split.table', Inf)
set.caption("My great data")
my.data <- " # replace the text below with your table data
Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement
Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement
Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement
Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement|Anticonstitutionnellement "

df <- read.delim(textConnection(my.data),header=FALSE,sep="|",strip.white=TRUE,stringsAsFactors=FALSE)
names(df) <- unname(as.list(df[1,])) # put headers on
df <- df[-1,] # remove first row
row.names(df)<-NULL
pander(df, style = 'rmarkdown')
```

在最终的PDF输出中,单词重叠。

我使用&#34; kable&#34;,&#34; table&#34;,&#34; print&#34;
你知道单词不重叠吗?

如果桌子很大,我希望桌子以横向格式自动旋转。有可能吗?

1 个答案:

答案 0 :(得分:0)

您可以尝试添加选项:

    classoption: landscape
在你的头部

---
title: "There is a reproductible example"
output: pdf_document
classoption: landscape
---

这将生成文档的横向版本。

相关问题