new_progress_bar: Progress bar

View source: R/progress.R

new_progress_barR Documentation

Progress bar

Description

A simple progress bar. This function is used in MCMC when the function has been called with a single processor.

Usage

new_progress_bar(
  n,
  probs = c(0, 0.25, 0.5, 0.75, 1),
  width = getOption("width", 80),
  symbol = "/",
  ...
)

Arguments

n

Integer. Number of steps.

probs

Double vector. Quantiles where to put marks

width

Integer. Width of the bar in characters.

symbol

Character. Single character symbol to print each bar.

...

Further arguments passed to cat() such as file and append.

Value

A function that can be included at the interior of a loop to mark the progress of the loop. It receives a single argument, i, which is the number of the current step.

Examples


x <- new_progress_bar(20)
for (i in 1:20) {
  Sys.sleep(2/20)
  x(i)
}


fmcmc documentation built on Aug. 30, 2023, 1:09 a.m.