[R] Removing objects and clearing memory

Kondor kbor at lanl.gov
Wed Sep 28 03:55:01 CEST 2011


>>>  How do I remove all objects except one in R? 

Here is another way. ls() gives you a list. get a number (n) of the item
you'd like to keep,
and then do:

rm(list=ls()[n+1:last])
rm(list=ls()[1:n-1])

ls() should return only one object after this.


--
View this message in context: http://r.789695.n4.nabble.com/Removing-objects-and-clearing-memory-tp3445763p3849780.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list