Skip to content
Prev 77122 / 398502 Next

How to erase objects

You can also use ls() which is alias of objects().

One way is to remove unwanted objects by hand
 rm(a,b,c,d)

Another way is to save the required objects, remove everything and then
load the saved objects.
 save(x,y,z, file="out.rda", compress=TRUE)
 rm( list=ls() )
 load("out.rda")

The second approach allows you to load the objects in a fresh R session,
which is one way to release memory if gc() fails. But which approach you
prefer depends on the number of objects to be removed and saved.

Regards, Adai
On Tue, 2005-09-13 at 04:39 -0700, Martin Lam wrote: