R R Quick Tips

How to clear RStudio panes with code

Here is how to clear RStudio console, environment and plot windows (panes) individually or at the same time by using code (a combination of functions).

Clear RStudio console, environment, plot panes and free up memory at once

Clear the RStudio console window

Clear the RStudio environment window

Clear the RStudio plot window

Free up memory for RStudio

There is a great function from the R base package called gc().

It is also possible to customize the RStudio startup and add it to your RProfile as an additional function into the base package. It looks like this.

For more detailed instructions on how to do it in your RProfile.site file go here.

As a result, you can call that function and clear RStudio panes with code any time you need a little cleanup.

Remember to add an additional free line at the end of your Rprofile. Reason here.



0 comments on “How to clear RStudio panes with code

Leave a Reply

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