I am attempting to create an R markdown pdf_document but the tables I am incorporating are coming out too small on the page
As a first step, I have tried to increase the height and width (hoping the font size would increase accordingly) of the initial DT datable but I cannot even get that working
DT::datatable(head(iris, 20)
and
DT::datatable(head(iris, 20), height = '1200px', width='1200px')
both result in an image this size
which appears even smaller in the pdf output
Any help appreciated
You can set the table width to 100%
(the default is a fixed width 960px
), then decrease the figure width so text can be larger. This is because your PDF page width is fixed. The larger your screenshot is, the smaller the text will be. An example:
---
title: "test"
output: pdf_document
---
```{r fig.width=5}
DT::datatable(head(iris, 20), width = '100%')
```
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.