I'm writing in R Markdown and have a contingency table that is quite wide. I am converting the R markdown document to a PDF using pandoc.
Is it possible to rotate or shrink the table? Ideally this would be done without having to switch to LaTeX formatting.
My Attempts:
I've been abusing the figure options in knitr to attempt this, but whether I use kable or xtable, I haven't had any luck. Some permutations I have tried include:
```{r out.extra='angle=90', results='asis'}
library(knitr)
kable(iris[1:5,])
```
``{r size='footnotesize', results='asis'}
library(knitr)
kable(iris[1:5,])
```
```{r out.extra='angle=90', results='asis'}
library(xtable)
xtable(iris[1:5,])
```
```{r size='footnotesize', results='asis'}
library(xtable)
xtable(iris[1:5,])
```
All of these show the table nicely, but do not rotate it.
The code I'm using to knit is:
Rscript -e "library(knitr); knit('table.Rmd', 'table.md')"
And to convert to pdf:
pandoc table.md -o table.pdf
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…