提取latex中回归模型的总结

Extract summary of regression model in latex

有没有一种方法可以像我在下面附上的相关性 table 那样以漂亮的乳胶格式提取回归模型的摘要?

# install.packages("dplyr")
# install.packages("kableExtra")
library(dplyr)
library(kableExtra)

mlm1 <- lm(mpg ~  . , data = mtcars)
summary(mlm1)


summary(mlm1) %>%
  kbl(caption="Table 1: Summary Statistics of Financial Well-Being  
               Score by Gender and Education",
       format= "html",
                  align="r") %>%
   kable_classic(full_width = F, html_font = "helvetica")

我建议使用 gt 包,它正在成为常态,同时 gtsummary 有很多 options and customizations for regression tables

library(dplyr)
library(gt)  
library(gtsummary)
  
mlm1 <- lm(mpg ~  . , data = mtcars)
# summary(mlm1)

mlm1 %>% 
  gtsummary::tbl_regression() %>%
  gtsummary::modify_caption("Table 1: Summary Statistics of Financial Well-Being  
                            Score by Gender and Education")

# Use gt::as_latex() for Latex  

reprex package (v2.0.1)

创建于 2022-01-24