R/timeop.R

Defines functions timeop

Documented in timeop

##' timeop function
##'
##' A function to time an operation in R
##'
##' @param expr an expression to evaluate
##' @return The time it took to evaluate the expression in seconds
##' @export

timeop <- function(expr){
    s<-Sys.time()
    eval(expr,envir=parent.frame())
    e<-Sys.time()
    return(difftime(e,s,units="secs"))
}

Try the miscFuncs package in your browser

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

miscFuncs documentation built on May 29, 2024, 2:01 a.m.