Use of substitute -- was More powerful than objects() or ls()
On Tue, 27 Mar 2001, Patrick Connolly wrote:
According to Prof Brian D Ripley: |> |> On Mon, 26 Mar 2001, Patrick Connolly wrote: |> ..... |> > I think it would be simple enough if I could get something in R to |> > work the way substitute() does in Splus. The thinking seems to be |> > very different between the two dialects. Maybe if I tinker a bit |> > longer, I'll get the connexion between them. |> |> They are almost the same. (See V&R's `S Programming' for a detailed |> comparison.) There is a difference when using function arguments: |> S uses the initial values, R the current ones, so in R one often needs to |> substitute early or take care to work on copies. Indeed, V&R explains it, so that's useful. Thanks again, Brian. But as Thomas Lumley anticipated, it is not straighforward to make use of comment with it. Writing to and sourcing from a temporary text file is not very elegant, but also not very complicated,
Using output text connections would be more elegant (implemented in R only at present, and only at 1.2.0 so post V&R).
|> Ah, I think most of us keep our functions in files not in objects, even in |> S-PLUS. I even keep my datasets in files (or databases). I know John |> Chambers advocates an `S object is master' view in the Green book, but I |> don't find it very practical given current tools. It is very practical with my Splus function (even though I could write it rather a lot better now). It's useful on those occasions when I attach to a directory where I did similar work some years ago and look through the lists, functions, matrices, dataframes and the like that I used there. I can quickly decide what I can use in the present directory. Even so, there is good reason to have a file of the code the function uses, and now I know how to use substitute, that's easy to automate. |> A CVS archive of R/S code is a very useful way of version control. Sounds interesting. Where will I find information about CVS archives? V&R don't have any mention in the index/es.
www.cvshome.org, I think currently (was www.cyclic.com). It's not to do with R/S but a way to keep on a server files and records of all changes. For example the R source code is kept in a CVS archive, as is all the V&R material (tex files as well as software). I guess the R-recommended way of working is to use packages, kept in source form, and to archive the package source.
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._