r clear all code example
Example 1: r remove all environment
rm(list = ls())
Example 2: how to clear rstudio environment
click on the brush icon in environment tab
rm(list = ls())
click on the brush icon in environment tab