从RMarkdown旋转PDF输出中的表格超过一页 [英] Rotating a table in PDF output from RMarkdown with more than one page
问题描述
我想在我的PDF输出中旋转一个宽表.我遇到了这个奇妙的问题,但是我的桌子更长.
I want to rotate a wide table in my PDF output. I came across this fantastic question, but my table is longer.
当我复制/粘贴该问题中显示的示例之一时,使用RMarkdown效果很好.
When I copy/paste one of the examples shown in that question, it works nice using RMarkdown.
library(kableExtra)
kable(iris[1:5,],
format = "latex", booktabs = TRUE) %>%
kableExtra::landscape()
但是,如果我们删除子设置,我们将看到表格超出了页面的尺寸.
However, if we remove the subsetting we see that the table exceeds the dimension of the page.
library(kableExtra)
kable(iris,
format = "latex", booktabs = TRUE) %>%
kableExtra::landscape()
所以我的问题很简单:如何通过将表格分成几部分来创建所需数量的PDF页面?
So my question is very simple: how can we create as many PDF pages as needed by splitting the table in parts?
推荐答案
可以尝试一下吗(对不起,我无法发表评论):
Can you try this (sorry I can't comment) :
dt <- iris
kable(dt, "latex", longtable = T, caption = "title") %>%
kable_styling(font_size = 7, latex_options = c("repeat_header"),repeat_header_text = "",
full_width = F) %>% kableExtra::landscape()
这似乎对我有用. 结果如下: pdf输出 是你想要的吗?
This seems to work for me. Here's the result : pdf output Is it what you want?
这篇关于从RMarkdown旋转PDF输出中的表格超过一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!