Sar*_*hGC 3 css datatable resize r
我正在使用包含数据表的 R markdown 生成报告。我希望生成的 html 保留一些边距,而不是表格填充页面的整个宽度。
我试过包括:
knitr::opts_chunk$set(fig.width=5, fig.height=8)
Run Code Online (Sandbox Code Playgroud)
我试过这个:
``` {r fig1, fig.height = 3, fig.width = 5, echo = FALSE, include=TRUE}
Run Code Online (Sandbox Code Playgroud)
我试过在输出下的标题中定义图形大小。我在数据表本身中使用了列宽选项。
有什么建议?
这是一个示例 Rmd:
---
title: "Initial Data Check Report"
date: "`r format(Sys.time(), '%B %d, %Y %H:%M:%S', 'America/Chicago', T)`"
output:
html_document:
self_contained: yes
theme: null
highlight: null
mathjax: null
params:
client: "ClientName"
---
### Audit Table
Some text here
---
```{r table, echo = FALSE, include=FALSE}
library(dplyr)
library(DT)
data = mtcars
```
``` {r fig1, fig.height = 3, fig.width = 5, echo = FALSE, include=TRUE}
datatable(data)
```
Run Code Online (Sandbox Code Playgroud)
会不会喜欢
<div style = "width:80%; height:auto; margin: auto;">
``` {r fig1, echo = FALSE, include=TRUE}
datatable(data)
```
</div>
Run Code Online (Sandbox Code Playgroud)
工作?
| 归档时间: |
|
| 查看次数: |
2274 次 |
| 最近记录: |