1

I would like to adjust the row padding in a jtools regression table. I tried set_row_height since I read that the underlying structure is a huxtable. But I'm unsure, and it didn't work.

---
title: "Untitled"
author: "Name"
date: "10 5 2021"
output: html_document
---

## R Markdown

```{r, warning=FALSE, message=FALSE}
mymodel <- lm(mpg ~ ., data=mtcars)

library(tidyverse)
library(jtools)
library(huxtable)

export_summs(mymodel, scale = TRUE) %>%
  set_font_size(6) %>%  # working in markdown html
  set_row_height(., everywhere, 0.1)  # not working in html
```

It looks fine in RStudio, but uses extensive row space in Markdown. set_font_size is working, but set_row_height not.

enter image description here

Marco
  • 2,368
  • 6
  • 22
  • 48
  • 1
    Show your code for `set_row_height()`. Did you try `set_tb_padding()`? – dash2 May 10 '21 at 16:54
  • I edited to show `set_row_height()`. Did not manage to use `set_tb_padding()` yet. – Marco May 11 '21 at 08:26
  • You don't need the `.` in `set_row_height` btw. – dash2 May 11 '21 at 14:16
  • Any luck so far? – dash2 May 15 '21 at 06:52
  • No luck, I tried without `.`, with and without `everywhere` and different values for row height. – Marco May 17 '21 at 09:07
  • And have you read `?row_height`? "Numeric heights are scaled to 1 and treated as proportions of the table height in HTML"... try CSS values. – dash2 May 18 '21 at 11:25
  • I can increase the row height with `"4em"` but cannot decrease it with `"0.4em"`. Negative values also have no effect. – Marco May 18 '21 at 12:51
  • Is `"0.4em"` output to HTML? My guess is yes (if not, probably a bug). If so, then blame the browser/the CSS specification. You might try fixing `height()` too. – dash2 May 18 '21 at 14:26

1 Answers1

1

Finally, row height adjustment worked with set_tb_padding. I cannot replicate why it didn't worked in the first place. set_row_height requires CSS/LaTeX values, i.e. set_row_height("4cm"). I cannot reduce row height to a resonable size but can increase row height.


title: "Jtools and Huxtable"
author: "Name"
date: "10 5 2021"
output: html_document
---

## R Markdown

```{r, warning=FALSE, message=FALSE}
mymodel <- lm(mpg ~ ., data=mtcars)

library(tidyverse)
library(jtools)
library(huxtable)

export_summs(mymodel, scale = TRUE) %>%
  set_font_size(10) %>% 
  set_tb_padding(1)
```

enter image description here

Marco
  • 2,368
  • 6
  • 22
  • 48