Skip to content
Prev 7412 / 398498 Next

organizing work; dump function

RH> In the past I have used several different working directories for different
RH> projects, and during many of these projects I have written some functions
RH> for particular purposes. Now I thought I would be nice to have all these
RH> "personal" functions collected in one place, and to make them available in R
RH> no matter which working directory I use.

RH> Reading the manual "An Introduction to R Version 1.0.0", chapter 10.8
RH> ("Customizing the environment"), I guess the (best ?) way to this is to dump
RH> all my functions into one big file "myfunctions.R" and source that into R
RH> via a .First function in my Rprofile file.

RH> But, when I write new functions and want to add these to my personal
RH> collection "myfunctions.R", it would be nice to have something like
RH> AFAIK this isn't possible (there is no append argument to dump), so I guess
RH> I have to create new files each time and then copy these together somehow.

RH> So my questions are:
RH> 1) Does this way to organize ones functions make sense, or are there better
RH> alternatives?

I personally have a private package of functions, which has the
advantage that the various workspaces are not polluted by copies of
the functions (if you source() code, it gets into the global
environment, packages maintain their own environment).

RH> 2) If it makes sense, wouldn't an "append" argument to "dump" be a useful
RH> thing?

Yes, independent of the above usage.  I'll add the feature in the
devel version.

Best,