# NOT RUN {
maximum <- 10
label <- "Estimated time to completion is being calculated\u2026"
pb <- ProgressBar(label = label, maximum = maximum, nsteps = maximum)
for (i in seq_len(maximum)) {
est.time <- system.time(Sys.sleep(1))["elapsed"] * (maximum - i)
label <- paste("Estimated time to completion is", round(est.time), "secs")
ans <- try(SetProgressBar(pb, value = i, label = label, step = i))
if (inherits(ans, "try-error")) break
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab