reportLoop: reportLoop

Description Usage Arguments Details Author(s) Examples

View source: R/reportLoop.R

Description

reportLoop is a nicely packaged progress reporter for your loop. It doesn't require any initialization like txtProgressBar does; you just drop the thing into your loop and it goes to work.

Usage

1
2
3
4
5
6
7
reportLoop(
  x,
  max,
  label=NA,
  waitSeconds=0,
  includePB=TRUE
)

Arguments

x

The current numeric iteration.

max

The maximum number of iterations.

label

A label for your loop. If NA (default), the loop goes unlabeled.

waitSeconds

The number of seconds to wait before starting the progress bar. This can be handy for processes that may either finish quickly or take a while to run. Defaults to 0, i.e. start progress bar immediately.

includePB

Whether to include a progress bar. Defaults to TRUE.

Details

By the way, a few quirks of the thing:

Author(s)

Jon Dayley

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
loopLimit <- 10
sleepTime <- 0.25
for(i in 1:loopLimit){
  durationTools::reportLoop(i,loopLimit,"Reporting a test loop...")
  Sys.sleep(sleepTime)
}
for(i in 1:loopLimit){
  durationTools::reportLoop(i,loopLimit,"Reporting another test loop...")
  Sys.sleep(sleepTime)
}

cadnza/durationTools documentation built on Aug. 6, 2021, 2:19 p.m.