[R] how to keep functions while remove all other commands
Henrik Bengtsson
hb at maths.lth.se
Sun Jan 25 10:21:21 CET 2004
Hi, it's not clear what you asking for, but if you want to remove all
object except functions here's the shortest one-line solution that I
can think of
rm(list=ls()[!sapply(ls(), FUN=exists, mode="function")])
Henrik Bengtsson
Lund University, Sweden
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Yong Wang
> Sent: den 25 januari 2004 04:47
> To: r-help-request at stat.math.ethz.ch
> Cc: r-help at stat.math.ethz.ch
> Subject: [R] how to keep functions while remove all other commands
>
>
> Dear all:
> a quick question:
> I am used to apply rm(list=()) regularly to remove all old codes in
> preventing them creeping in current analysis.however, with that
> application, functions I wrote are also removed. please let
> me know how to keep the thing you want while remove those you don't.
>
> thank you
>
> best
> yong
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailma> n/listinfo/r-help
> PLEASE
> do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
More information about the R-help
mailing list