I'm looking for a function that returns the time at which a permanently stored version of a dataset (object) was last modified, just like dataset.date in S-Plus. Any suggestions? --------------------------------- [[alternative HTML version deleted]]
What do you mean by `a permanently stored version of a dataset'? If you mean a save()d version, use file.info() on the saved file. R does not store objects `permanently' as S-PLUS (sic) does, so your exact phrasing is meaningless. On Tue, 4 May 2004, Jason Watts wrote:> I'm looking for a function that returns the time at which a permanently > stored version of a dataset (object) was last modified, just like > dataset.date in S-Plus. Any suggestions?-- 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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Jason Watts <jcwatts999 <at> yahoo.com> writes:> > I'm looking for a function that returns the time at which a permanentlystored version of a dataset (object)> was last modified, just like dataset.date in S-Plus. Any suggestions?I think others have already answered this (i.e. R does not store objects in files so you can't get the dates of those files); however, if its only specific objects whose dates you need and you are willing to set them yourself you could do something like this: # create object and set timestamp in an attribute df <- data.frame(a=1:5,b=letters[1:5]) attr(df,"timestamp") <- Sys.time() # ... # update object and timestamp df$a <- df$a+1 attr(df,"timestamp") <- Sys.time() # ... # show last modified time attr(df,"timetamp") You could get much fancier by creating a class which automatically appends and updates timestamps whenever an operation is performed on its objects. That would be even easier to use but it would be more work to set up initially.