R/system_time.R

Defines functions system_time

Documented in system_time

#' Version of `system.time()` that works with assignment
#'
#' Print CPU (and other) times that `expr` used, return value of `expr`
#'
#' @param expr Valid R expression to be timed, evaluated and returned
#'
#' @return Result of evaluating `expr`
#' @export
system_time <- function(expr) {
    print(system.time(expr))
    expr
}

Try the farr package in your browser

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

farr documentation built on May 29, 2024, 6:41 a.m.