RINNER Heinrich
2000-Sep-29 07:09 UTC
[R] SUMMARY and follow up question: organizing work; dump function
Thanks very much to Friedrich Leisch, Brian Ripley and Thomas Lumley for their useful answers. Basically, they all suggested creation of a personal package as the easiest and best way to hold ones own functions. This indeed is quite easy and very useful. In addition, Friedrich Leisch pointed out that he's planning to add an "append" argument to the dump() function. One follow up question, though: It seems that any comments that may be present in a packages function file are invisible in R (version 1.0.0, Windows NT 4.0); e.g.> library(cluster) > page(agnes) > print(agnes)--> comments (as "#check type of input vector" in line 29 in file "cluster") don't show up here. Is this behaviour intended? I mean, some potentially useful information may get lost this way (as an "ordinary" user, I would look at a function definition by page() or print(), unlikely by looking in a packages function file). Heinrich.>>>>> On Thu, 28 Sep 2000 15:54:01 +0200, >>>>> RINNER Heinrich (RH) wrote:>> Dear R-users! >> >> I am using R 1.0.0 and Windows NT 4.0 >>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>> dump("new.function", file="myfunctions.R", append=TRUE).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? RH> 2) If it makes sense, wouldn't an "append" argument to "dump" be a useful RH> thing? -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian D Ripley
2000-Sep-29 08:23 UTC
[R] SUMMARY and follow up question: organizing work; dump function
On Fri, 29 Sep 2000, RINNER Heinrich wrote:> Thanks very much to Friedrich Leisch, Brian Ripley and Thomas Lumley for > their useful answers. > > Basically, they all suggested creation of a personal package as the easiest > and best way to hold ones own functions. This indeed is quite easy and very > useful. > > In addition, Friedrich Leisch pointed out that he's planning to add an > "append" argument to the dump() function.Yes, he said so, but I also said that I though connections were a much more general solution.> One follow up question, though: > It seems that any comments that may be present in a packages function file > are invisible in R (version 1.0.0, Windows NT 4.0); e.g. > > library(cluster) > > page(agnes) > > print(agnes) > --> comments (as "#check type of input vector" in line 29 in file "cluster") > don't show up here. > > Is this behaviour intended? I mean, some potentially useful information may > get lost this way (as an "ordinary" user, I would look at a function > definition by page() or print(), unlikely by looking in a packages function > file).It is intended. Look at options(keep.source) and the keep.source argument to library. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._