[R] Date/time of formation of objects

John Logsdon j.logsdon at lancaster.ac.uk
Mon Oct 18 10:57:41 CEST 1999


Is there any way of attaching the date and time of formation of an object
so that ls() can report such things in a manner similar to the Unix ls
command?  And/or a comment attached?  Could this be added to the
housekeeping wish-list?

I usually use my own little command lls() (below) that reminds me of the
mode and size of a structure since I often have R sesssions open for days
at a time.  Addition of the date and time and a comment describing the
function or whatever would be a great aid to my poor memory and an
alternative to losing the piece of paper I have written the description
down on.  Sorting by date/time would automatically group all objects
created at the same time together.

Presumably since S+ stores everything in .Data this can automatically be
arranged by system('ls -lrt .Data') for example, just about the only
advantage of overworking your disk other than error recovery that I can
think of.  Assuming Unix of course.

Just a thought - along with the autosave when quiescent that I posted a
little while ago ... 


lls<-function (pat = "") 
    lll <- ls(1, pat = pat)
    for (i in 1:length(lll)) {
        cat(formatC(eval(parse(t = paste("mode(", lll[i], ")"))), 
            1, 12), formatC(lll[i], 1, max(nchar(lll)) + 1), 
            eval(parse(t = paste("dimx(", lll[i], ")"))), "\n")


dimx<-function (dd) 
    if (is.null(dim(dd))) {
    else {

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