[英]How can i enlarge a datatable in the R DT package?
I am attempting to create an R markdown pdf_document but the tables I am incorporating are coming out too small on the page我正在尝试创建一个 R markdown pdf_document 但我合并的表格在页面上显示的太小了
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 数据的高度和宽度(希望字体大小会相应增加),但我什至无法让它工作
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在pdf输出中显得更小
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.您可以将表格宽度设置为
100%
(默认为固定宽度960px
),然后减小图形宽度以使文本更大。 This is because your PDF page width is fixed.这是因为您的 PDF 页面宽度是固定的。 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%')
```
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.