Re: [R] Best way to remove all objects but leave the functions in a workspace.

2012-02-07 Thread Barry Rowlingson
Best? Probably not. No money back if this deletes everything by mistake: remove(list=ls()[sapply(ls(),function(n){!is.function(get(n))})]) As a function, maybe: clearNonF=function(e=.GlobalEnv){remove(list=ls(e)[sapply(ls(e),function(n){!is.function(get(n))})],envir=e)} clearNonF() will clear o

[R] Best way to remove all objects but leave the functions in a workspace.

2012-02-07 Thread Keith Weintraub
I think the subject says it all. Thanks in advance, KW -- [[alternative HTML version deleted]] __ 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