Generate beautiful summary table output for lmer models in R Markdown?

Viewed 1181

I have a lot of lmer models with a summary() output that looks like this (usually with more variables, this was just a very quick nonsense example I generated):

Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: mpg ~ cyl + hp + disp * drat + (1 | gear) + (1 | carb)
   Data: mtcars

REML criterion at convergence: 171.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.4583 -0.5671 -0.2118  0.3912  2.1303 

Random effects:
 Groups   Name        Variance Std.Dev.
 carb     (Intercept) 2.07353  1.4400  
 gear     (Intercept) 0.04659  0.2158  
 Residual             7.63829  2.7637  
Number of obs: 32, groups:  carb, 6; gear, 3

Fixed effects:
            Estimate Std. Error       df t value Pr(>|t|)  
(Intercept)  6.27454   11.75344 25.17470   0.534   0.5981  
cyl         -0.30519    0.84443 25.55852  -0.361   0.7208  
hp          -0.01412    0.01798 10.10227  -0.785   0.4503  
disp         0.03101    0.03649 23.25810   0.850   0.4041  
drat         5.97395    2.65430 24.44199   2.251   0.0337 *
disp:drat   -0.01380    0.01172 24.05299  -1.178   0.2503  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
          (Intr) cyl    hp     disp   drat  
cyl       -0.512                            
hp        -0.087 -0.337                     
disp      -0.710 -0.021  0.341              
drat      -0.965  0.317  0.142  0.823       
disp:drat  0.698 -0.131 -0.461 -0.950 -0.778
convergence code: 0
Model failed to converge with max|grad| = 0.0112263 (tol = 0.002, component 1)

Is there a way to generate a summary() output with all of this information, but nicely formatted for RMarkdown? I've found a variety of solutions for Markdown (e.g. kable, huxtable, pander), but most of them are only able to display for example the Fixed Effects table. In those examples, the Signif. codes stars (*-***) are usually also not shown.

I'm looking for a function that gives me an output just like this, but formatted for RMarkdown and including the significance codes.

0 Answers
Related