问题
I want to rotate a wide table in my PDF output. I came across this fantastic question, but my table is longer.
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()
So my question is very simple: how can we create as many PDF pages as needed by splitting the table in parts?
回答1:
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()
This seems to work for me. Here's the result : pdf output Is it what you want?
来源:https://stackoverflow.com/questions/55362295/rotating-a-table-in-pdf-output-from-rmarkdown-with-more-than-one-page