François Pinard <[EMAIL PROTECTED]> writes: > [Seth Falcon] >>Here's a function you could try. It names the result as you >>suggested. It also can be nested, which system.time cannot, because >>it uses on.exit without specifying add=TRUE. > > Thanks, Seth. Your code could be useful, I'm saving it. :-)
You make it sound like that code is going to mature like a wine. I'd say, if it isn't useful now, it will be less useful later, but hey, disk space is cheap :-D > Just to be clear, my suggestion was more thought as a small benefit > for the community of R users, rather than for myself alone. That's what I understood. I bothered to post some code because I agree and saw a couple of small ways to improve system.time: add names, allow nesting, and compute the time once instead of twice[*]. Perhaps others will agree and consider a change. Best, + seth [*] system.time computes the elapsed time twice: once when running the on.exit hook, which gets called explicitly (!), and once for the return value. Here's the relevant lines: on.exit(cat("Timing stopped at:", proc.time() - time, "\n")) ## once eval(expr, envir = loc.frame) new.time <- proc.time() on.exit() new.time - time ## twice ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel