I usually use modelsummary()
or stargazer()
for extracting tables to latex in R. However, they seem to not work with lme4. Does someone know a way to extract this reproducible example to a nice latex table?
Here is my model:
df <- tibble(
y = rnorm(100000),
x1 = rnorm(100000),
x2 = rnorm(100000),
school =sample.int(300,size=100000,replace=TRUE)-1,
classes =sample.int(100,size=100000,replace=TRUE)-1
)
df$school = as.factor(df$school)
df$classes = as.factor(df$classes)
library(lme4)
model1 <- lmer(y~ x1 + x2 +
(x1 + x2 |classes) +
(x1 + x2 |school), data=df)
As of version 0.6.4 (on CRAN now),
modelsummary
supportslme4::lmer
models out of the box. You simply need to update your package and try again.