I have code to clear the workspace: rm(list=ls()) and code to clear the console: cat(\"\\014\")
rm(list=ls())
cat(\"\\014\")
Is there code to clear all plots from Rstudio?<
dev.off() only works in an interactive session. If you're interested in implementing such behavior in a script, you should use
dev.off()
graphics.off()
instead.