I have written a function to serve as a wrapper around ggsave()
to save plots as an EMF (for use with PowerPoint).
emf_save <- function(ggp) {
filename <- glue::glue("{here()}",
"/",
"{deparse(substitute(ggp))}.emf")
ggsave(
plot = ggp,
filename = filename,
height = 5.2,
width = 11.5,
units = "in",
device = devEMF::emf()
)
dev.off()
print(paste0("Saved ", filename))
}
It accepts a ggplot2 object and saves an EMF file with the object's name. The problem is, whenever I call this function, it also saves a file called Rplot.emf in the project folder.
How do I prevent this file generation?