bbolker / broom.mixed

tidy methods for mixed models in R
229 stars 24 forks source link

Issue with broom.mixed tidy on linear mixed effect model #155

Open reinpmomz opened 1 week ago

reinpmomz commented 1 week ago

I am getting the following error when i want to print the lmer output using tbl_regression.

Error in if (result$label %in% c("Beta", "exp(Beta)")) { : argument is of length zero

I guess broom.mixed tidy is not creating a label column

bbolker commented 1 week ago

I'm a little puzzled. I didn't think that label was in the usual set of columns produced by tidy methods anyway, e.g. from plain old broom:

> m <- lm(hp ~ mpg + disp, mtcars)
> library(broom)
> tidy(m)
# A tibble: 3 × 5
  term        estimate std.error statistic p.value
  <chr>          <dbl>     <dbl>     <dbl>   <dbl>
1 (Intercept)  172.       69.9        2.46  0.0199
2 mpg           -4.27      2.30      -1.86  0.0737
3 disp           0.261     0.112      2.33  0.0267

This works for me (modulo some unrelated problems with viewing the results in my web browser)

library(lme4)
library(gtsummary)
m2 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
tbl_regression(m2)

Could I please have a reproducible example and the results of sessionInfo() from a clean R session?

By the way, this is what I could find by doing a web search for the error message: