plot doesn't save when using in conjunction with `par(mfrow = c(2,2))`

Unsure of what tags to use here, I guess it's just base R?

Small code block within and Rmd file:

mod <- glm(formula = price ~ carat, family = "poisson", data = diamonds)
par(mfrow = c(2,2))
mod_fit_plot <- mod %>% plot

When running this I see a single plot displayed with 4 facets or 'chartlets' as desired:

However, if I subsequently type model_fit_plot into the console, it comes back NULL. Expected to see the plot print again in the plots pane.

How can I save my plot as a variable?

Quick answer: You can't.

As far as I am aware you cannot save basic R charts & graphs as a variable. the best you can do is save to disc with something like ?png.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.