Dear UseRs, I would like to know the created time and date of specific object. Is there any function for it? Thank you in advance. Sincerely,
On Tue, 6 Nov 2007, Dong-hyun Oh wrote:> Dear UseRs, > > 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. -- 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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Of course, Brian is correct that the problem requires a great deal more specificity. However, one could imagine that it would be useful to tag objects created by top-level expressions with the time they were created in much the same way that the file system provides a modification time. It is easy enough to add the time as an attribute of an object, but I imagine you are asking how to automate this. To this end, you could do something with the addTaskCallback() function which allows you to specify a function that is invoked at the completion of each top-level evaluation. You could get store some useful time information with the object or perhaps go further and work with the expressions to determine dependencies and capture the dependencies in a series of computations. D. Dong-hyun Oh wrote:> Dear UseRs, > > I would like to know the created time and date of specific object. > Is there any function for it? > > Thank you in advance. > > > Sincerely, > > ______________________________________________ > R-help at 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.-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHMJ579p/Jzwa2QP4RAhyoAJ9aFlRXAKP6bfmgol2MDTSQzyujRACfdCaX G19v83tjpMOqyUIfeBRn0/k=TBXf -----END PGP SIGNATURE-----
The trackObjs package will do this, at the level of objects in an environment. E.g., from the docs: > library(trackObjs) > track.start("tmp1") > x <- 123 # Not yet tracked > track(x) # Variable 'x' is now tracked > track(y <- matrix(1:6, ncol=2)) # 'y' is assigned & tracked > z1 <- list("a", "b", "c") > z2 <- Sys.time() > track(list=c("z1", "z2")) # Track a bunch of variables > track.summary(size=F) # See a summary of tracked vars class mode extent length modified TA TW x numeric numeric [1] 1 2007-09-07 08:50:58 0 1 y matrix numeric [3x2] 6 2007-09-07 08:50:58 0 1 z1 list list [[3]] 3 2007-09-07 08:50:58 0 1 z2 POSIXt,POSIXct numeric [1] 1 2007-09-07 08:50:58 0 1 > # (TA="total accesses", TW="total writes") (creation time is tracked too, but not displayed with default settings) For more info, look in the trackObjs package. -- Tony Plate Dong-hyun Oh wrote:> Dear UseRs, > > I would like to know the created time and date of specific object. > Is there any function for it? > > Thank you in advance. > > > Sincerely, > > ______________________________________________ > R-help at 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. >