looptimer | R Documentation |
For timing loops
looptimer(
tim,
n,
i,
when_ready = TRUE,
memory = 50,
prefix = "",
endline = "\n",
printevery = 1,
fg = NULL,
bg = NULL,
use_msg = TRUE
)
tim |
Previous instance of timer to be updated |
n |
total count in the loop |
i |
iteration that was just finished |
when_ready |
if true add ETA to message. |
memory |
How many iteration back remember when computing the average time |
prefix |
prefix for print message |
endline |
If print called, which endline character to use? Default '\n'. Usual alternative is something like ' \r' |
printevery |
Print every nth iteration only. Affects print-method. |
fg |
Use ANSI color for the print text? Integer from 1 to 256. |
bg |
Use ANSI color for the print background? Integer from 1 to 256. |
use_msg |
Use message for printing? Default is TRUE. If not, use cat |
Approximative iteration speed, time left, and ETA.
N <- 100
t0 <- looptimer(n = N, fg = 2, prefix = "[testing]", printevery = 10)
for(i in 1:N){
# do something
Sys.sleep(runif(1))
print( t0 <- looptimer(t0) )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.