>>>  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.

______________________________________________
R-help@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.

Reply via email to