Spaces between columns in stargazer type = “html” table output

别说谁变了你拦得住时间么 提交于 2019-12-05 03:50:21

If you are writing an RMarkdown document, you can customize your HTML tables using stylesheets.

This can be done adding the option CSS to your YAML header. Something like this:

---
title: "My HTML Doc"
output:
  html_document:
    css: styles.css
---

To increase the spacing between columns you could, for example, add some padding to the left of the cells. So, in your styles.css files you could put something like:

th, td {
    padding-left: 10px;
    text-align: left;        
}

For further information about using CSS in RMarkdown, please check this. For more about CSS for HTML tables, please check this.

You can also drop the CSS directly into the RMarkdown document (see here). eg.

---
title: "Untitled"
author: "Author"
date: "29 June 2017"
output: html_document
---

<style>

table, td, th {
  border: none;
  padding-left: 1em;
  padding-right: 1em;
  min-width: 50%;
  margin-left: auto;
  margin-right: auto;
  margin-top: 1em;
  margin-bottom: 1em;
}

</style>


```{r, results = "asis"}

stargazer::stargazer(mtcars, type = "html")

```
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!