Description Usage Arguments Details Value See Also Examples
View source: R/progress-client.R
This is the reference manual of the three functions that create, update and terminate progress bars. For a tutorial see the cli progress bars.
cli_progress_bar()
creates a progress bar.
cli_progress_update()
updates the state of a progress bar, and
potentially the display as well.
cli_progress_done()
terminates a progress bar.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | cli_progress_bar(
name = NULL,
status = NULL,
type = c("iterator", "tasks", "download", "custom"),
total = NA,
format = NULL,
format_done = NULL,
format_failed = NULL,
clear = getOption("cli.progress_clear", TRUE),
current = TRUE,
auto_terminate = type != "download",
extra = NULL,
.auto_close = TRUE,
.envir = parent.frame()
)
cli_progress_update(
inc = NULL,
set = NULL,
total = NULL,
status = NULL,
extra = NULL,
id = NULL,
force = FALSE,
.envir = parent.frame()
)
cli_progress_done(id = NULL, .envir = parent.frame(), result = "done")
|
name |
This is typically used as a label, and should be short, at most 20 characters. |
status |
New status string of the progress bar, if not |
type |
Type of the progress bar. It is used to select a default
display if
|
total |
Total number of progress units, or |
format |
Format string. It has to be specified for custom progress bars, otherwise it is optional, and a default display is selected based on the progress bat type and whether the number of total units is known. Format strings may contain glue substitution, the support pluralization and cli styling. |
format_done |
Format string for successful termination. By default
the same as |
format_failed |
Format string for unsuccessful termination. By
default the same as |
clear |
Whether to remove the progress bar from the screen after it has temrinated. |
current |
Whether to use this progress bar as the current progress bar of the calling function. See more at 'The current progress bar' below. |
auto_terminate |
Whether to terminate the progress bar if the number of current units reaches the number of total units. |
extra |
Extra data to add to the progress bar. This can be
used in custom format strings for example. It should be a named list.
|
.auto_close |
Whether to terminate the progress bar when the
calling function (or the one with execution environment in |
.envir |
The environment to use for auto-termination and for glue substitution. It is also used to find and set the current progress bar. |
inc |
Increment in progress units. This is ignored if |
set |
Set the current number of progress units to this value.
Ignored if |
id |
Progress bar to update or terminate. If |
force |
Whether to force a display update, even if no update is due. |
result |
String to select successful or unsuccessful termination.
It is only used if the progress bar is not cleared from the screen.
It can be one of |
cli_progress_update()
updates the state of the progress bar and
potentially outputs the new progress bar to the display as well.
cli_progress_bar()
returns the id of the new progress bar.
The id is a string constant.
If current = TRUE
(the default), then the new progress bar will be
the current progress bar of the calling frame. The previous current
progress bar of the same frame, if there is any, is terminated.
cli_progress_update()
returns the id of the progress bar,
invisibly.
cli_progress_done()
returns TRUE
, invisibly, always.
cli_progress_message()
and cli_progress_step()
for simpler
progress messages.
1 2 3 4 5 6 7 8 | clean <- function() {
cli_progress_bar("Cleaning data", total = 100)
for (i in 1:100) {
Sys.sleep(5/100)
cli_progress_update()
}
}
clean()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.