| BasicBar | R Documentation |
This is a concrete implementation of the abstract class Bar
using the utils::txtProgressBar() as engine for the progress bar.
parabar::Bar -> BasicBar
new()Create a new BasicBar object.
BasicBar$new()
An object of class BasicBar.
create()Create a progress bar.
BasicBar$create(total, initial, ...)
totalThe total number of times the progress bar should tick.
initialThe starting point of the progress bar.
...Additional arguments for the bar creation passed to
utils::txtProgressBar().
This method returns void. The resulting bar is stored in the private
field .bar, accessible via the active binding engine. Both the
private field and the active binding are defined in the super class
Bar.
update()Update the progress bar by calling utils::setTxtProgressBar().
BasicBar$update(current)
currentThe position the progress bar should be at (e.g., 30 out of 100), usually the index in a loop.
terminate()Terminate the progress bar by calling base::close() on the
private field .bar.
BasicBar$terminate()
clone()The objects of this class are cloneable with this method.
BasicBar$clone(deep = FALSE)
deepWhether to make a deep clone.
Bar, ModernBar, and BarFactory.
# Create a basic bar instance.
bar <- BasicBar$new()
# Specify the number of ticks to be performed.
total <- 100
# Create the progress bar.
bar$create(total = total, initial = 0)
# Use the progress bar.
for (i in 1:total) {
# Sleep a bit.
Sys.sleep(0.02)
# Update the progress bar.
bar$update(i)
}
# Terminate the progress bar.
bar$terminate()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.