Learn R Programming

statuser (version 0.1.9)

clear: Clear Plot, Global Environment, and Console

Description

Clears plot, global environment, and console. On first use the user is prompted to authorize clearing the environment to comply with CRAN rules.

Usage

clear()

Arguments

Value

Invisibly returns NULL. Prints a colored confirmation message.

Details

This function performs three cleanup operations:

  • Plot: Closes all open graphics devices (except the null device)

  • Global environment: Removes all objects from the global environment

  • Console: Clears the console screen (only in interactive sessions)

clear() will not modify the global environment unless you have previously typed "yes" when prompted. If you do not type "yes", you are asked again next time; only "yes" is remembered for future sessions.

Warning: This function deletes all objects in the global environment. Save anything that you wish to keep before running.

Examples

Run this code
# \donttest{
# Interactive use: clear workspace, console, and plots
# First run may prompt; once you type "yes", your preference is saved.
clear()
# }

Run the code above in your browser using DataLab