[R] Cleaning things up?

Douglas Bates bates at stat.wisc.edu
Tue Oct 17 16:58:32 CEST 2000

"Yves Gauvreau" <cyg at sympatico.ca> writes:

> Ok, that's sounds reasonable for the future. The problem I have is that I
> have close to 500 items returning from length(ls()) many of which are
> function I've created on the fly and they interact with each other. I know
> it's a mess and this the reason for my query, I'd like to clean it up. I
> mean separating functions from other objects (saving them, document them and
> etc.) and do as you suggest for the future.
> So I ask again, is there a way to do that or do I have to do it all by
> "hand" one at a time?

If you mean "can I determine which objects are functions?", the answer
is yes.  It would look something like this

nms <- ls()
funcs <- nms[unlist(lapply(as.list(nms), function(nm) is.function(get(nm))))]
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list