> >> How do I remove all objects except one in R?
> >>
> > rm(list=ls()) #will remove ALL objects
>
> But he wanted to remove all objects ***except one***!!! So what's the
> point of this answer?
>
> I can't see any way except a rather round-about kludge to do what the
> OP wants. ...
That might work. Or try this, replacing QQQ with the name of the object
you want to keep.
rm(list=ls()[!grepl('^QQQ$',ls())])
cur
--
Curt Seeliger, Data Ranger
Raytheon Information Services - Contractor to ORD
[email protected]
541/754-4638
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.