mb <- function(..., times=25) {
  if(require(microbenchmark, quietly=TRUE)) {
    mb.c <- match.call()
    mb.c[[1]] <- quote(microbenchmark::microbenchmark)
    res <- eval(mb.c, parent.frame())
    res.sum <- summary(res)
    cat(attr(res.sum, "unit"), "\n")
    print(res.sum[1:5])
  } else {
    warning("Package microbenchmark not available.")
  }
}


Try the vetr package in your browser

Any scripts or data that you put into this service are public.

vetr documentation built on Jan. 7, 2023, 1:19 a.m.