My solution to the clutter problem is this: at start-up time, create a list of functions, attach the list and then delete the list. I haven't delved into making packages yet.
if (any(search()=="MyFunctions")) detach(MyFunctions) MyFunctions <- list() MyFunctions$ "%like%" <- function(x,y) { seq_along(x) %in% grep(y,x,ignore=TRUE) } MyFunctions$ trim <- function(txt) { gsub("^ +| +$", "", txt) } # You can also put data into the list: MyFunctions$ tau = 2 * pi # etc... attach(MyFunctions) rm(MyFunctions) All that is in MyFunctions.R which I can source() again when I update it. >>> From: "Abhijit Dasgupta, PhD" <aikidasgu...@gmail.com> To:<s.chamai...@yahoo.fr> CC:<r-help@r-project.org> Date: 10/Jul/2011 1:40a Subject: Re: [R] Storing and managing custom R functions for re-use I think most of us are in a similar situation. I've usually kept mine in a file which is sourced when I start R. The main problem I have with this is that it clutters up my environment with a lot of stuff I don't need all the time. I'm in the process of creating a custom package which will be lazy-loaded. I believe a previous discussion of this topic suggested this as the preferred method. [[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-guide.html and provide commented, minimal, self-contained, reproducible code.