I have read a solution to this using tic(), toc() functions
tic <- function(gcFirst = TRUE, type=c("elapsed", "user.self", "sys.self"))
{
type <- match.arg(type)
assign(".type", type, envir=baseenv())
if(gcFirst) gc(FALSE)
tic <- proc.time()[type]
assign(".tic", tic, envir=baseenv())
invisible(tic)
}
toc <- function()
{
type <- get(".type", envir=baseenv())
toc <- proc.time()[type]
tic <- get(".tic", envir=baseenv())
print(toc - tic)
invisible(toc)
}
tic();
-----code----
toc();
elapsed
0.15
But I would like to get a lot of precision in milliseconds?
Also I was using this
ptm <- proc.time()
---code
proc.time() - ptm
and get this
user system elapsed
1.55 0.25 1.84
How to get more decimals or more precision?
proc.time
: "The resolution of the times will be system-specific and on Unix-alikes times are rounded to the nearest 1ms." – Andreaandreana