statusbar: A statusbar for for loops

View source: R/statusbar.R

statusbarR Documentation

A statusbar for for loops

Description

This functions prints the progess of a for loop to the console.

Usage

statusbar(run, max.run, width = 20L, info = run, percent.max = width)

Arguments

run

the iterator of the for loop or an integer with the current loop number.

max.run

either an integer with the maximum number of loops if run is also a number, or a vector with all possible iterations in the correct order.

width

an integer that indicates how wide the progress bar is printed.

info

a string with additional information to be printed at the end of the line. The default is run.

percent.max

is deprecated, use width instead.

Value

Has no return value, but prints the progress to the console.

Author(s)

Jakob Gepp

Examples


for (i in 1:200) {
  Sys.sleep(0.01)
  statusbar(run = i, max.run = 200, width = 60L)
}

for (i in letters[1:16]) {
  Sys.sleep(0.1)
  statusbar(run = i, max.run = letters[1:16], width = 60L)
}


STATWORX/helfRlein documentation built on Feb. 12, 2024, 2:21 a.m.