replicate: Same as 'base::replicate()' but with a progress bar.

View source: R/replicate.R

replicateR Documentation

Same as base::replicate() but with a progress bar.

Description

Same as base::replicate() but with a progress bar.

Usage

replicate(
  n,
  expr,
  simplify = "array",
  format = "Replicating : [:bar] :percent in :elapsed",
  ...
)

Arguments

n

Integer: the number of replications.

expr

The expression (a language object, usually a call) to evaluate repeatedly.

simplify

Passed to base::sapply(), see the docs there.

format

Progress bar format.

...

Extra arguments are passed to progress_bar$new().

Examples

replicate(50000, rnorm(1) > 1.65) |>
    (\(x) list(mean = mean(x), sd = sd(x)))()

r-lib/progress documentation built on June 11, 2025, 5:51 p.m.