I'm using knitr
and pander
to make a table in a markdown file. I'm converting the markdown file to a PDF using Pandoc from within R.
This code:
library(knitr)
```{r myTable, echo=FALSE, message=FALSE, results='asis', comment=""}
library(pander)
pandoc.table(head(iris))
```
then running this function within R:
knitsPDF <- function(name) {
knit(paste0(name, ".Rmd"), encoding = "utf-8")
callformat <-"pandoc -V geometry:margin=1in %s.md -o %s.pdf"
system(sprintf(callformat, name, name))
}
knitsPDF(name) # insert file name of .Rmd file
produces this table in the PDF file:
How can I 1. Reduce width of columns in table? 2. Reduce font size of table?
\normalsize
after the table (one empty line after table caption) makes the font size normal after the table (if using the\footnotesize
for the table). – Lobate