[R] Use of substitute -- was More powerful than objects() or ls()

Patrick Connolly P.Connolly at hortresearch.co.nz
Tue Mar 27 06:08:15 CEST 2001


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,


|> 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.

best

-- 
*************************************************************
Patrick Connolly
HortResearch                        Great minds discuss ideas;
Mt Albert                           Average minds discuss events; 
Auckland                            Small minds discuss people.
New Zealand                                                 .... Anon
Ph: +64-9 815 4200 x 7188
*************************************************************
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list