2

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()

enter image description here

So my question is very simple: how can we create as many PDF pages as needed by splitting the table in parts?

antecessor
  • 2,688
  • 6
  • 29
  • 61

1 Answers1

6

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?

Gainz
  • 1,721
  • 9
  • 24