Keith Weintraub
2012-Feb-07 16:13 UTC
[R] Best way to remove all objects but leave the functions in a workspace.
I think the subject says it all. Thanks in advance, KW -- [[alternative HTML version deleted]]
Barry Rowlingson
2012-Feb-07 18:43 UTC
[R] Best way to remove all objects but leave the functions in a workspace.
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 out the current workspace. Maybe. On Tue, Feb 7, 2012 at 4:13 PM, Keith Weintraub <kw1958 at gmail.com> wrote:> I think the subject says it all.Barry