Skip to content
Back to formatted view

Raw Message

Message-ID: <4A1296FB.3000700@bitwrit.com.au>
Date: 2009-05-19T11:24:43Z
From: Jim Lemon
Subject: remove empty objects from workspace
In-Reply-To: <dd40a8b0905190344v4be87a7ch337dd2fbe30e6fd2@mail.gmail.com>

Katharina May wrote:
> Hi,
>
> how can I remove all empty objects (which are NA or have zero rows)
> from my workspace?
>
>   
Hi Katharina,
To remove objects that are all NA:

for(object in objects()) if(all(is.na(get(object)))) rm(list=object)

If by "zero rows" you mean objects that do not have a dimension:

for(object in objects()) if(is.null(dim(get(object)))) rm(list=object)

Jim