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

______________________________________________
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