[R] More powerful than objects() or ls()

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon Mar 26 08:08:49 CEST 2001


On Mon, 26 Mar 2001, Patrick Connolly wrote:

>
> According to Thomas Lumley:
> |>
> |> On Thu, 22 Mar 2001, Patrick Connolly wrote:
> |> >
> |> > There are times when the date is very valuable information,
> |> > particularly years later.  I would like to be able to do something
> |> > similar in R but of course, the same method won't work because objects
> |> > are not stored as separate unix files in a .Data directory.
> |
>
> .....
>
> |> comment() does the information management you need. There isn't an
> |> automatic way of doing the date information and I can't think ofa general
> |> one that wouldn't be horribly slow.  You could add a date-setting function
>
> 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.

> |> to your most frequnelty used object creation functions  (perhaps
> |> read.table and glm in my case).
>
> That works easily for read.table, and probably for glm, but how would
> I make it work for the function function which works internally?  It's
> the age of my functions that I'm most interested in -- largely
> historical interest.  I've found it immensely useful in Splus.  I'm a
> little surprised others aren't so interested.

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.  A CVS archive of R/S
code is a very useful way of version control.

B

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



More information about the R-help mailing list