On Tue, 6 Nov 2007, Alberto Monteiro wrote: > > Prof Brian Ripley wrote: >> >>> I would like to know the created time and date of specific object. >>> Is there any function for it? >> >> There isn't even the concept. Most objects in R are a collection of >> SEXPRECs created at different times. Suppose you create a data >> frame out of existing columns, and then later change the names? What >> does 'created' mean for the data frame? >> >> In any case, none of the possibly relevant date-times is stored. >> > I imagine that it could be possible to create a class that > would store the "creation time" of its objects... but I have > no idea how to do it (I think I could do it in C++, but I am > illiterate in R++ oops S4 classes).
You could record the time at which you recorded the time by e.g. attr(x, "creation time") <- Sys.time() but this would be subject to all the ambiguities I mentioned. For an S4 class you could have a slot for time and assign it in the constructor, but it is commonplace to use new() to create a skeleton object and then fill it in. You would then need to arrange for all the subset and subassignment methods to either preserve or update the time. -- Brian D. Ripley, [EMAIL PROTECTED] 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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.