Closed ghost closed 2 years ago
I'm having the exact same error. I have just tested the previous version on CRAN (4.2.4) and it works.
I'm so sorry you are getting this error! I'm not able to reproduce this error using dates or character variables, so I'm not sure what the problem is. @lucasxteixeira, when you say "it works", do you mean it functions correctly, or you are able to reproduce the error in your dataset? Would you please show me the exact code you are running? Would you be willing to share your data? If not, could you run summary()
on the relevant variables? Thanks!
@ngreifer I found the issue, and it is pretty simple. The bal.tab probably uses a separate function that is imported when the cobalt package is loaded. So, when we use the function though the namespace without loading explicitly the errors appears:
lalonde <- read.csv("lalonde.csv")
w.out <- WeightIt::weightit(treat ~ age + educ + race + married + nodegree + re74 + re75, data = lalonde)
cobalt::bal.tab(w.out, thresholds = c(m = 0.1), un = TRUE)
@lucasxteixeira thank you so much for finding that out. With that knowledge, I was able to fix the issue, and I should have an updated version soon.
I created a
matchit
object settingdistance="mahalanobis"
andexact=~specialty + event_month
, wherespecialty
is of character type (only two possible values) andevent_month
of date type.Calling
summary
on the matchit object correctly returns the balanace statistics: Theevent_month
variable was implicitly converted to numeric, whilespecialty
seems to be converted into 0 or 1s for each possible value. For both variables,summary.matchit
is able to compute a std. mean difference.However, calling
bal.tab
on the matchit object results in the error:Any advice on how to handle this error?