[R] How to remove all objects except a few specified objects?

Dejian Zhao zhaodj at ioz.ac.cn
Wed Aug 25 03:32:10 CEST 2010


 If your specified objects have a certain pattern, you can use the 
parameter "pattern" in ls() to remove or keep it.
rm(list=ls(..., pattern="your_pattern"))
If not, possibly you have to manually specify them.

On 2010-8-24 3:00, Cheng Peng wrote:
> How to remove all R objects in the RAM except for a few specified ones?
> rm(list=ls()) removes all R objects in the R work space.
>
> Another question is that whether removing all R objects actually releases
> the RAM? Thanks.
>



More information about the R-help mailing list