Learn R Programming

lsr (version 1.0.0)

rmAll: Remove all objects from the workspace

Description

Deletes all objects from the workspace, with an optional confirmation prompt.

Usage

rmAll(ask = TRUE)

Value

Invisibly returns 1 if objects were deleted, 0 if the user declined or the workspace was already empty.

Arguments

ask

Set to TRUE (the default) to display the current workspace contents and ask for confirmation before deleting. Set to FALSE to delete immediately without prompting.

Details

Removes all objects from the workspace. When ask = TRUE, the list of objects is printed and the user must type y to confirm before anything is deleted. This is similar to rm(list = objects()), but with an interactive safety check.

See Also

Examples

Run this code
if (FALSE) {
  # interactive: displays workspace contents and asks for confirmation
  rmAll()

  # non-interactive: deletes immediately without prompting
  rmAll(ask = FALSE)
}

Run the code above in your browser using DataLab