progress_updater: Print a basic progress indicator to console

Description Usage Arguments Value Examples

View source: R/progress_updater.R

Description

Include this function in a loop or other calculation that iterates over elements in which both the current and total number of elements is known.

Usage

1
progress_updater(i, n, grp = NULL, rnd = 0, indent = 0)

Arguments

i

numeric vector of length == 1. The current iteration value

n

numeric vector of length == 1. The number of iterations to calculate

grp

character or numeric vector of length == 1. Optional additional identifier to be placed in parentheses following the printed percent. Defaults to NULL, in which case no additional group identifier is printed

rnd

numeric vector of length == 1. The number of decimal values in the printed percent. Defaults to rnd = 0, in which case only the integer value percents will be printed. Set to rnd = 1 to obtain tenths of a percent, rnd = 2 to obtain hundredths, etc.

indent

numeric vector of length == 1. The number of space characters to indent the printed percent.

Value

A printed percent to the console (i/n * 100)

Examples

1
 junk = sapply(1:15, function(i) {progress_updater(i, 15, rnd = 1); Sys.sleep(0.2)})

bstaton1/StatonMisc documentation built on May 18, 2020, 12:06 a.m.