On 02/02/2009 8:16 AM, Paulo Grahl wrote:
Dear list members,

Does anyone know how to use rm() to remove only variables but not
declared functions from the environment ?
I understand I could name all the functions with, let's say
"f_something", make sure that all variables do not start with "f_" and
then remove all BUT objects starting with "f_".
However, I have already defined all the functions and it would be
troublesome to change all of them to a new name.

Any hint ?

Here's a list of functions:  lsf.str()
And here's a list of everything:  ls()
So here are non-functions:  setdiff(ls(), lsf.str())
And here they go:  rm(list = setdiff(ls(), lsf.str()) )

Duncan Murdoch

______________________________________________
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