1

I generated a few tables in R Markdown out of data frames using kable, the tables are too big for the portrait page. So I'm trying to change the portrait side to a landscape side in the knitted pdf. The problem is, that it only works for me if there is no caption or footnotes in the tables. Is there an easy way to change this?

In the code, I show you everything I tried up to now.

header-includes: 

  \usepackage{pdflscape}

  \usepackage{lscape}

  \usepackage{rotating}


\begingroup

\begin{landscape}

\begin{sidewaystable}

```{r comment='1', echo=FALSE, results='asis',}

load(file = "Data/VPNCondition.RData")
kable(VPNCondition, format="latex",booktabs=TRUE, 
      caption="Distribution of subjects between conditions and trials") %>%
  kableExtra::landscape() %>%
  footnote(general=c('This table shows the breakdown of the experimental groups.',
                     'These subjects were able to survive all claims and exclusion criteria of the pre-analysis',
                     'and preparation of the data and are included in the data analysis.')) %>%
  kable_styling(bootstrap_options="basic", font_size=14, full_width=FALSE,
                latex_options=c("scale_down"))
```
\endgroup
\end{landscape}
\end{sidewaystable}
jay.sf
  • 60,139
  • 8
  • 53
  • 110
severin
  • 111
  • 1
  • 1
  • 6
  • Sorry for the layout. As with tables, it looks like I'm also struggling with GUI's – severin Jul 26 '19 at 08:59
  • I've removed the data.table tag because it seems unrelated as you are not using that package. Also, consider if you should add the [tag:latex] tag. – Roland Jul 26 '19 at 09:11
  • You are more likely to get answer from latex people, if you provide the output of your R code. – Roland Jul 26 '19 at 09:12
  • @Roland thank you very much. The output to my R code is just a pdf-file of a table. Unfurtionaly this is in portrait and not in landscape. Nothing I tried, changed the outcome of that pdf file. Only if I remove all text, then it rotates the page. – severin Jul 26 '19 at 09:24
  • What happens if you suppress the 'lscape' package? pdflscape is supposed to supersede it and their interaction maybe problematic. – Alain Merigot Jul 26 '19 at 09:41
  • @AlainMerigot, unfortunately, it stays the same. I'm not sure, but could it be, that it has to do with the R Markdown papaja package, that I use for the APA-layout in the pdf-file? The table is moved through papaja to the end of the pdf – severin Jul 26 '19 at 10:16

0 Answers0