Learn R Programming

schoRsch (version 1.10)

clear_all_but: Clear Parts of Global Workspace

Description

The global workspace is cleared while keeping (only) selected variables.

Usage

clear_all_but(keep = NULL)

Arguments

keep

Variables to keep. Specified as a vector of strings.

Author

Moritz Schaaf

Details

An R version of the eponymous custom MATLAB function (https://de.mathworks.com/matlabcentral/fileexchange/25339-clear-all-but).

See Also

clear; rm; ls;

Examples

Run this code
## Declare variables
a <- 1
b <- "abc"
c <- NA
ls()

## Clear workspace
clear_all_but(c("a","b"))
ls()

Run the code above in your browser using DataLab