The R package cleaR provides a function
clear() to be used to clean the console and the whole R
environment. After calling cleaR::clear(), all assigned
variables, functions and the printed stuff in the console will be
removed.
You can install cleaR directly from CRAN:
install.packages("cleaR")The development version can be installed using
install.packages("remotes")
remotes::install_github("joundso/cleaR", ref = "dev")