stargazer 类型中列之间的空格 = "html" table 输出
Spaces between columns in stargazer type = "html" table output
我正在寻找一种方法(或替代方法)来在 stargazer html-table 输出的列之间获取空格。
作为
stargazer::stargazer(mtcars, type = "html")
结果
读起来不太好...
提前致谢!
塞缪尔
如果您正在编写 RMarkdown 文档,您可以使用样式表自定义 HTML 表格。
这可以通过将选项 CSS 添加到您的 YAML header 来完成。像这样:
---
title: "My HTML Doc"
output:
html_document:
css: styles.css
---
例如,要增加列之间的间距,您可以在单元格的左侧添加一些填充。因此,在您的 styles.css
文件中,您可以放置如下内容:
th, td {
padding-left: 10px;
text-align: left;
}
有关在 RMarkdown 中使用 CSS 的更多信息,请 check this. For more about CSS for HTML tables, please check this。
您也可以将 CSS 直接放入 RMarkdown 文档中(参见 )。例如
---
title: "Untitled"
author: "Author"
date: "29 June 2017"
output: html_document
---
```{css, echo = FALSE}
table, td, th {
border: none;
padding-left: 1em;
padding-right: 1em;
margin-left: auto;
margin-right: auto;
margin-top: 1em;
margin-bottom: 1em;
}
```
```{r, results = "asis"}
stargazer::stargazer(mtcars, type = "html")
```
我正在寻找一种方法(或替代方法)来在 stargazer html-table 输出的列之间获取空格。
作为
stargazer::stargazer(mtcars, type = "html")
结果
读起来不太好...
提前致谢!
塞缪尔
如果您正在编写 RMarkdown 文档,您可以使用样式表自定义 HTML 表格。
这可以通过将选项 CSS 添加到您的 YAML header 来完成。像这样:
---
title: "My HTML Doc"
output:
html_document:
css: styles.css
---
例如,要增加列之间的间距,您可以在单元格的左侧添加一些填充。因此,在您的 styles.css
文件中,您可以放置如下内容:
th, td {
padding-left: 10px;
text-align: left;
}
有关在 RMarkdown 中使用 CSS 的更多信息,请 check this. For more about CSS for HTML tables, please check this。
您也可以将 CSS 直接放入 RMarkdown 文档中(参见
---
title: "Untitled"
author: "Author"
date: "29 June 2017"
output: html_document
---
```{css, echo = FALSE}
table, td, th {
border: none;
padding-left: 1em;
padding-right: 1em;
margin-left: auto;
margin-right: auto;
margin-top: 1em;
margin-bottom: 1em;
}
```
```{r, results = "asis"}
stargazer::stargazer(mtcars, type = "html")
```