Spaces between columns in column stargazer type = "html" table output

I am looking for a method (or alternative) to get spaces between the output columns of the stargazer html table.

how

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

leads to

enter image description here

which is not very good to read ...

Thanks in advance!

Samuel

+4
source share
2 answers

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

You can do this by adding a CSS parameter to your YAML header. Something like that:

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

To increase the spacing between columns, you can, for example, add a few paddings to the left of the cells. So in your files styles.cssyou can add something like:

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

CSS RMarkdown, , . CSS HTML, , .

+3

CSS RMarkdown (. ). .

---
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")

```
+2

Source: https://habr.com/ru/post/1607485/


All Articles