Re: [R] deleting variables

From: Rubén Roa-Ureta <>
Date: Tue, 29 Apr 2008 12:09:25 -0400

Richard Pearson wrote:
> ?rm
> Richard

> Ralf Goertz wrote:
>> How can I automatically exclude one variable from being saved in the
>> workspace when I quit an R session? The problem is I don't know how to
>> erase a variable once it has been created.


>> Ralf

More on the use of rm. If you want to delete many variables in one go,


ls() #you check all the objects in your workspace #[1] "x" "y" "z"
rm(list=your.list <- ls()[2:3]) #you selected to delete all those objects whose indices are between 2 and 3. rm("your.list") #remove the temporary list with variable names ls()
[1] "x"

Rubén mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Apr 2008 - 18:00:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Apr 2008 - 18:30:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive