Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

love.plot: Error in scale_override_call(call) #83

Open
rafaelglezm opened this issue Feb 29, 2024 · 5 comments
Open

love.plot: Error in scale_override_call(call) #83

rafaelglezm opened this issue Feb 29, 2024 · 5 comments

Comments

@rafaelglezm
Copy link

I'm trying to produce a loveplot of a matchit object, but I get the following error
"Error in scale_override_call(call) :
could not find function "scale_override_call"

I'm using MacOS, R 4.3.2 and the last Cobalt GitHub version (cobalt_4.5.4), and ggplot2 3.5.0

The code is the following:

matching_obj <- matchit(y ~ a + b + c + d, data = dataset, method = "nearest", ratio = 2, caliper = 0.1)
love.plot(matching_obj,
binary = "std",
sample.names = c("Unmatched", "Matched"),
thresholds = c(m = .1),
title = NULL)

Thanks in advance

@ngreifer
Copy link
Owner

Hi Rafael,

Unfortunately, I am not able to replicate this issue using these versions of the package. The updated version of cobalt is on CRAN, so you should be able to install it from there.

To diagnose this issue, can you give me a minimally reproducible data example (e.g., using lalonde), and when you get the error, please run traceback() and include the output in your reply.

@rafaelglezm
Copy link
Author

Hi Noah
Thank you very much for your quick response and help.
I have restarted R, re-installed Cobalt from CRAN (Version 4.5.4, Build Date: 2024-02-26), and now it works perfectly
Best regards,
Rafael

@himawork
Copy link

himawork commented Mar 4, 2024

So did I

library(cobalt)
data("lalonde", package = "cobalt")

Propensity score weighting

w.out1 <- WeightIt::weightit(
treat ~ age + educ + race + married +
nodegree + re74 + re75,
data = lalonde
)

love.plot(w.out1, thresholds = c(m = .1), var.order = "unadjusted")

Error in scale_override_call(call) :

could not find function "scale_override_call"

re-install cobalt didn't solve this error
and I didn't find function "scale_override_call" in any source file of cobalt package.

@ngreifer
Copy link
Owner

ngreifer commented Mar 4, 2024

@himawork it's code that exists in ggplot2, so my only recommendation would be to reinstall that and try again. Unfortunately I cannot reproduce the error on my machine.

@jdeu1023
Copy link

I also had this issue. I uninstalled ggplot2 and cobalt then reinstalled them, and that fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants