Here’s how to Clear the Console and the Environment in R Studio coding

R Studio is an built-in improvement atmosphere(IDE) for R. IDE is a GUI, the place you possibly can write your quotes, see the outcomes and likewise see the variables which can be generated through the course of programming.

Clearing the Console

We Clear console in R and RStudio, In some instances if you run the codes using “source ” and “source with echo ” your console will grow to be messy. And it’s wanted to clear the console. So let’s now have a look at clear the console. The console could be cleared using the shortcut keyctrl + L “.


In this below screenshot, an R code is written in the script tab defined a and calculated b and printed a, b . When this code is executed using “source with echo ” all of the instructions will get printed within the console tab. Now, to clear this console click on on the console tab and enter the important thing mixture “ctrl + L “. Once it is done the console will get cleared.

Note: Remember that clearing the console will not delete the variables that are there in the workspace. You can see that in the environment tab although we have cleaned the console in the workspace we still have the variables that are created earlier.

Clearing the Environment

Variables on the R environment can be cleared in two ways:

Using rm() command:

When you want to clean a single variable from the R environment you can use therm() ” command adopted by the variable you wish to take away.

-> rm(variable)

variable: that variable identify you wish to take away.

If you wish to delete all of the variables which can be there within the atmosphere what you are able to do is you should utilize the “rm” with an argument “list” is the same as “ls” adopted by a parenthesis.

-> rm(record=ls())

Using the GUI:

We also can clear all of the variables within the atmosphere using the GUI within the atmosphere pane.

How does it really works?

You see this brush button within the atmosphere pane.

So if you press the comb button it would pop up a window saying “you want to remove all the objects from the environment?”

And if you happen to say sure it would clear all of the variables that are proven right here and you’ll see the atmosphere is empty now.

Add a Comment

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