From bbolker at gmail.com  Mon Jul  4 17:49:40 2016
From: bbolker at gmail.com (Ben Bolker)
Date: Mon, 4 Jul 2016 11:49:40 -0400
Subject: [Rd] cat() in proc.time?
Message-ID: <577A8594.9070408@gmail.com>


  Does anyone know if there's a reason that proc.time() uses cat()
rather than message() to print the output when there has been an error
in the process of timing?

line 31 of time.R,

https://github.com/wch/r-source/blob/e5b21d0397c607883ff25cca379687b86933d730/src/library/base/R/time.R#L31

on.exit(cat("Timing stopped at:", ppt(proc.time() - time), "\n"))

  This means that as far as I can tell the general way to make sure
there is no output from a timed statement is ...

     tt1 <- capture.output(tt0 <- suppressMessages(suppressWarnings(
                try(<stuff to try>,
                    silent=TRUE))))

(I know I could/should be using tryCatch() instead of try(), but I don't
think it really matters here ... ?)

  What would people think of a request to change this to message()
rather than cat() in the future ... ?  (This would mess up code that is
already using capture.output() to store this information ...)

  cheers
    Ben Bolker



[Rd] cat() in proc.time?
Ben Bolker