微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

R Markdown 中使用 jtools 的回归模型中的行高

如何解决R Markdown 中使用 jtools 的回归模型中的行高

我想调整 jtools 回归表中的行填充。我尝试了 set_row_height,因为我读到底层结构是 huxtable。但我不确定,它没有用。

---
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
```

它在 RStudio 中看起来不错,但在 Markdown 中使用了大量的行空间。 set_font_size 有效,但 set_row_height 无效。

enter image description here

解决方法

最后,行高调整适用于 set_tb_padding。我无法复制为什么它首先不起作用。 set_row_height 需要 CSS/LaTeX 值,即 set_row_height("4cm")。我无法将行高降低到合理的大小,但可以增加行高。


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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。