Skip to content
Back to formatted view

Raw Message

Message-ID: <3DFF55F0.267407F0@pdf.com>
Date: 2002-12-17T17:53:06Z
From: Sundar Dorai-Raj
Subject: cleaning up after example()

> Dear R-help,
> 
> I find the example() function is extremely useful in many ways.  However,
> there's a minor inconvenience: for long examples, it leaves lots of objects
> in the workspace.  While it's sometimes useful to have the objects around
> for further exploration, other times they just add to the clutter.  Does
> anyone have a good way of cleaning up afterward?  If not, would R core
> consider adding such a feature?
> 

Andy,
  One quick fix would be to take a snapshot of your current workspace,
then delete anything new afterwards. Of course, this doesn't account for
overwritten variables.

> snapshot = ls()
> example("smooth",pack="eda",lib.loc=.Library)
...
> remove(list = ls()[!ls()%in%snapshot]) # also removes `snapshot'

Regards,
Sundar

-- 
Sundar Dorai-Raj
PDF Solutions, Inc.
Dallas TX