Use R Code to Remove All Graphics Shown in RStudio (Example Code)

In this article, I’ll show how to remove all plots that are shown in RStudio in the R programming language.

Example: Clear All Graphics Shown in RStudio

plot(1:5)                           # Create several plots in RStudio
barplot(1:5)
plot(1:5, 9:5)
dev.off(dev.list()["RStudioGD"])    # Using dev.off() & dev.list() functions

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top