tkprogress: Create a progress bar and function to control it.
Description
This function opens a new graphical window with a progress bar
(originally set at 0) and returns a function to be used to control the
progress bar. This can be used inside of a loop to show your progress.
Usage
tkprogress(numsteps = 100, title = "Progress")
Arguments
numsteps
The number of steps for the progress bar, generally
the number of iterations of your loop
title
A title for the window holding the progress bar
Value
A function to control the progress bar, the arguments for the function are:
incThe amount to increment the progress bar (overridden by
other arguments)
setThe value to set the progress bar to (integer between 0
and nubsteps)
quitShould the progress bar quit and its window go away
Details
This function creates a window and a progress bar (using Tk) and
returns a function that controls the progress bar.
This function uses only packages with namespaces so can be called as
TeachingDemos::tkprogress without having the package loaded.
The return value is a function for controlling the progress bar. If
the returned function is called without any arguments then the
progress bar is incremented 1, given a value it will increment by that
much. Called with set=n will jump the progress bar to n (an
integer between 0 and numsteps). Called with quit=TRUE
will remove the progress bar and its window.