

If you need any further assistance feel free to contact us here. Just define it as follows and call it by typing clc(). If you want to define your own function to clear the console, you can easily do that. rm(list = ls()) Method 3: Customize a function to Erase R Console You can also use the following command to clear variables in R. cat("\014") cat("\f")īoth of these functions are used to send Ctrl+L to the console which helps to clear the console. You can remove all objects in R by writing a function in the code. There is another method to clear the screen. Method 2: Define a Function to Clear Environment in R You can do both by restarting your R session in RStudio with the keyboard shortcut Ctrl+Shift+F10 which will totally clear your global environment of both. This works with all Windows, Linux, and Mac. Simply hit Ctrl+L on the keyboard and you will see that everything written in the console will be erased and the console will be cleared. The shortest and the quickest way to clear the global environment in R is by using shortcut keys from the keyboards. Method 3: Customize a function to Erase R Console Method 1: Clear R Console using Shortcuts Sometimes, the user may not like previous commands appearing in the console window so, in this article, we are going to learn two different methods to clear the workspace in R. Also, after running many commands, these commands will remain in the console. This information is given in the beginning to instruct the user if he needs help. These windows are names as:Īs soon as you launch RStudio, you see some information on the console.

The fourth window is not shown as default but you can open it by clicking File-> New File-> R Script. You can see three different windows as soon as you launch RStudio. Working on the Rstudio console is very productive because of the variety of features offered by it but a lot of people ask how they can clear console in R. It is very similar to the RGuibut it has more dropdown menus, windows, and multiple tabs which makes it very easy and interesting to use. RStudio is an opensource Integrated Development Environment (IDE) that provides a user-friendly environment for the user to interact with the R language more rapidly.
