keep: Remove All Objects, Except Those Specified

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/keep.R

Description

Remove all objects from the user workspace, except those specified.

Usage

1

Arguments

...

objects to be kept, specified one by one, quoted or unquoted.

list

character vector of object names to be kept.

all

whether hidden objects (beginning with a .) should be removed, unless explicitly kept.

sure

whether to perform the removal, otherwise return names of objects that would have been removed.

Details

Implemented with safety caps: objects whose name starts with a . are not removed unless all=TRUE, and an explicit sure=TRUE is required to remove anything.

Value

A character vector containing object names, or NULL when sure is TRUE.

Author(s)

Arni Magnusson

See Also

keep is a convenient interface to rm when removing most objects from the user workspace.

Examples

1
2
3
4
data(women, cars)
keep(cars)
## To remove all objects except cars, run:
## keep(cars, sure=TRUE)

Example output

sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

[1] "women"

gdata documentation built on May 2, 2019, 8:49 a.m.