R/handler_txtprogressbar.R
handler_txtprogressbar.Rd
A progression handler for utils::txtProgressBar()
.
(character) The symbols to form the progress bar for
utils::txtProgressBar()
. Contrary to txtProgressBar()
, this handler
supports also ANSI-colored symbols.
(integer) The progress-bar style according to
utils::txtProgressBar()
.
(connection) A base::connection to where output should be sent.
(numeric) A non-negative scalar on how intrusive (disruptive) the reporter to the user.
(character vector) Specifies where progression updates are rendered.
Additional arguments passed to make_progression_handler()
.
Below are a few examples on how to use and customize this progress handler.
In all cases, we use handlers(global = TRUE)
.
handlers(handler_txtprogressbar(style = 1L))
y <- slow_sum(1:25)
handlers(handler_txtprogressbar(style = 3L))
y <- slow_sum(1:25)
handlers(handler_txtprogressbar(char = "#"))
y <- slow_sum(1:25)
handlers(handler_txtprogressbar(char = "<>"))
y <- slow_sum(1:25)
handlers(handler_txtprogressbar(char = cli::col_red(cli::symbol$heart)))
y <- slow_sum(1:25)
handlers("txtprogressbar")
with_progress({ y <- slow_sum(1:10) })
#> M: Added value 1
#> M: Added value 2
#> M: Added value 3
#> M: Added value 4
#> M: Added value 5
#> M: Added value 6
#> M: Added value 7
#> M: Added value 8
#> M: Added value 9
#> M: Added value 10
print(y)
#> [1] 55