Closed MiguelGodinhoMatos closed 3 years ago
Thank you for letting me know! I'll look into that right away.
@ngreifer thanks for being so quick. I already tested your solution. However, I think it does not work for factors. You are not taking factor levels into account. These are only known after you create the model.matrix (the model.frame is not enough). Ideally, you would always work with the formula functions I suppose.
#Still does not work
m.out1 <- matchit(treat ~ factor(age) + educ + race + married + nodegree + re74 + re75,data = lalonde)
love.plot(m.out1, var.order = "unadjusted")
Error in
.rowNamesDF<-
(x, value = value) : duplicate 'row.names' are not allowed In addition: Warning message: non-unique value when setting 'row.names': ‘factor(age)’
Thank you for finding this! I'm pretty sure I've fixed it now. Dealing with formulas is such a pain.
love.plot and bal.tab are not dealing correctly with the formula object when there are inline operations applied to a variable. The bug occurs only when the raw variable is not included in the formula object.
Replicable code:
The behavior is true in both versions: cobalt_4.2.2 and cobalt_4.2.1
Environment for replication (also works on 4.x).