Re: [R] deleting variables

From: Rubén Roa-Ureta <rroa_at_udec.cl>
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,

x<-runif(10)
y<-runif(10)
z<-runif(10)

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"

HTH
Rubén



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive