purrrogress (version 0.1.1)

progress_bar: Create a R6 progress bar directly

Description

Create a R6 progress bar directly

Usage

progress_bar(total, title = "Progress", ...,
  type = getOption("progress.type", infer_type()))

Arguments

total

the total number of elements

title

the title of the progress bar

...

passed on to the specific constructor determined by type.

type

the type of progress bar to create as a string, or an R6ClassGenerator object for a class that inherits from the "R6 Progress Base Class".

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
pb_win <- progress_bar(100, "Windows Progress", type = 'win')
# }
# NOT RUN {
pb_txt <- progress_bar(100, "Text Progress", type = 'txt')
pb_txt$init() # starts the timer and shows the bar.
pb_txt$step() # take 1 step update progress bar.
pb_txt$step(25) # take 24 steps at one time
pb_txt$term() # do finishing tasks for progress bar.

# The following use Unicode characters and may not work with all fonts.
# DejaVu Sans Mono is one font which supports all the characters used
pb_bar   <- progress_bar(100, "Bar Progress", type = 'bar')
pb_line  <- progress_bar(100, "Line Progress", type = 'line')
pb_box   <- progress_bar(100, "Box Progress", type = 'box')
pb_block <- progress_bar(100, "Block Progress", type = 'block')

# }

Run the code above in your browser using DataLab