add_brackets fails with lmer models
Closed this issue · 1 comments
misea commented
But it works if you drop the "group" column created by tidy(lmer_model) before plotting
library(lme4)
data("mtcars")
m1 <- lm(mpg~wt+disp + cyl, data = mtcars)
{dwplot(m1)} %>% add_brackets(list(c("G1", "wt", "wt"), c("G2", "disp", "disp")))
# Looks good
m2 <- lmer(mpg~wt+disp+(1|cyl), data = mtcars)
{dwplot(m2)} %>%
add_brackets(list(c("G1", "wt", "wt"), c("G2", "disp", "disp")))
# Error: `by` can't contain join column `group` which is missing from LHS
dev.off()
# Now get rid of the group column created by tidying lmer models
{dwplot(tidy(m2) %>% select(-group))} %>%
add_brackets(list(c("G1", "wt", "wt"), c("G2", "disp", "disp")))
# Looks good again
sammo3182 commented