Skip to contents

Progress bars in patter are implemented via the pbapply package. These can be customised or suppressed before the implementation of patter functions that use progress bars via pbapply::pboptions(). These simple wrappers facilitate the internal implementation of progress bars via pbapply functions.

Usage

pb_init(.min, .max)

pb_tick(.pb, .t)

pb_close(.pb)

See also

These functions wrap pbapply::setpb and associated routines.

Examples

if (FALSE) { # \dontrun{
# Define loop
loop <- function() {
  n <- 10L
  pb <- pb_init(.min = 0L, .max = n)
  for (i in seq_len(n)) {
    Sys.sleep(0.1)
    pb_tick(pb, .t = i)
  }
  pb_close(pb)
}

# Show default progress bar
loop()

# Customise default progress bar
pbo <- pbapply::pboptions(type = "txt")
loop()

# Suppress progress bar
pbo <- pbapply::pboptions(type = "none")
loop()

# Reset options
pbapply::pboptions(pbo)
} # }