[R] Age of an object?

Philippe Grosjean phgrosjean at sciviews.org
Wed Dec 14 11:17:13 CET 2005

Martin Maechler wrote:
>>>>>>"Trevor" == Trevor Hastie <hastie at stanford.edu>
>>>>>>    on Tue, 13 Dec 2005 12:51:34 -0800 writes:
>     Trevor> It would be nice to have a date stamp on an object.
>     Trevor> In S/Splus this was always available, because objects were files.
>    [are you sure about "always available"? 
>     In any case, objects were not single files anymore for a
>     long time, at least for S+ on windows, and AFAIK also on
>     unixy versions recently ]
> This topic has come up before.
> IIRC, the answer was that for many of us it doesn't make sense
> most of the time: 

I remember it was discussed several times. I don't remember why it was 
considered too difficult to do.

> If you work with *.R files ('scripts') in order to ensure
> reproducibility, you will rerun -- often source() -- these files,
> and the age of the script file is really more interesting.
> Also, I *always* use the equivalent of  q(save = "no") and
> almost only use save() to particularly save the results of
> expensive  computations {often, simulations}.

OK, now let me give examples where having such an information would ease 
the work greatly: you have a (graphical) view of the content of an 
object (for instance, the one using the "view" button in R commander), 
or you have a graphical object explorer that has a cache to speed up 
display of information about objects in a given workspace (for instance, 
the SciViews-R object explorer). What a wonderful feature it will be to 
tell if an object was changed since last query. In the view, one could 
have a visual clue if it is up-to-date or not. In the object explorer, I 
could update information only for objects that have changed...

>     Trevor> I have looked around, but I presume this information is not available.
> I assume you will get other answers, more useful to you, which
> will be based on a class of objects which carry an
> 'creation-time' attribute.  

Yes, but that would work only for objects designed that way, and only if 
the methods that manipulate that object do the required housework to 
update the 'last-changed' attribute (the question was about last access 
of an object, not about its creation date, so 'last-changed' is a better 
attribute here). If you access the object directly with, let's say, 
myobject at myslot <- newvalue, that attribute is not updated, isn't it?


Philippe Grosjean

> Martin Maechler, ETH Zurich
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list