clear_all_but: Clear Parts of Global Workspace

View source: R/clear_all_but.R

clear_all_butR Documentation

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.

Details

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

Author(s)

Moritz Schaaf

See Also

clear; rm; ls;

Examples

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

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

schoRsch documentation built on Nov. 2, 2022, 1:06 a.m.