rmarkdownhuxtable

Row height in regression models with jtools in R Markdown


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


Solution

  • 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