Saving Plots
png() and dev.off() or ggsave write images to files.
Example
f <- tempfile(fileext = ".png")
png(f, width = 400, height = 300)
plot(1:3)
dev.off()
print(file.exists(f))
unlink(f)Exercise
Close the device.
.off()Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.