0

I am using the PanelMatch package's balance_scatter function to generate plots such as the one seen below:

balance_scatter(nn_match_5_1,
                  data = merged,
                  covariates = c("lpop", "lmilper", "ldeaths", "wardur"))

enter image description here

I would like to convert this image to an object within R. I assumed I could use the standard assignment operator:

plot <- balance_scatter(nn_match_5_1,
                  data = merged,
                  covariates = c("lpop", "lmilper", "ldeaths", "wardur"))

However, when I do this, I get the following error:

NULL

When I see how this object is stored in my local environment, it is stored as simply "NULL" under a "Values" section. (See image below):

enter image description here

I am at a bit of a loss, and I am wondering if anyone knows what might be causing this and how I might be able to convert this to an object.

  • 2
    The `balance_scatter` looks like it's using base graphics to make the plot. Base graphics do not return objects. They are functions that run with side effects that draw to the current graphics device. Some ideas for work-arounds can be found here: https://stackoverflow.com/questions/29583849/save-a-plot-in-an-object. – MrFlick Jan 20 '23 at 20:34

0 Answers0