| doCallWE | R Documentation |
doCallWE() performs the innermost computation of the simulation
study at hand. It is a version of do.call(f, argl, *),
with care of catching and storing both error and warnings (via
tryCatch.W.E()) and measures user time. This is useful
in large(r) simulation studies.
mkTimer() returns a function to be passed as
timer to doCallWE().
doCallWE(f, argl,
timer = mkTimer(gcFirst=FALSE))
mkTimer(gcFirst)
f |
a |
argl |
list of arguments for |
timer |
a |
gcFirst |
logical, passed to |
Note that gcFirst=FALSE is default for a good reason: if a call
to doOne() is relatively fast, calling gc() every
time is unnecessarily expensive and may completely dominate the
overall simulation run time. For serious run time measurement,
gcFirst=TRUE is preferable, as it ensures less
variable timings, see system.time.
doCallWE() returns a list with components
value |
|
error |
error message (see |
warning |
warning message (see |
time |
time, as measured by |
Marius Hofert and Martin Maechler.
do.call, tryCatch.W.E.
set.seed(61)
L <- log(abs(rt(n=100, df = 1.5)))
r <- doCallWE(quantile, list(L, probs= 0.95))
## set timer for "no timing" :
u <- doCallWE(quantile, list(L, probs= 0.95), timer = function(E) { E; NULL })
stopifnot(is.null(r$error),
all.equal(r$value, quantile(L, 0.95)),
identical(r[1:3], u[1:3]), is.null(u[["time"]]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.