rerun

0th

Percentile

Re-run expressions multiple times.

This is a convenient way of generating sample data. It works similarly to replicate(..., simplify = FALSE).

Usage
rerun(.n, ...)
Arguments
.n

Number of times to run expressions

...

Expressions to re-run.

Value

A list of length .n. Each element of ... will be re-run once for each .n. It

There is one special case: if there's a single unnamed input, the second level list will be dropped. In this case, rerun(n, x) behaves like replicate(n, x, simplify = FALSE).

Aliases
  • rerun
Examples
# NOT RUN {
10 %>% rerun(rnorm(5))
10 %>%
  rerun(x = rnorm(5), y = rnorm(5)) %>%
  map_dbl(~ cor(.x$x, .x$y))
# }
Documentation reproduced from package purrr, version 0.2.5, License: GPL-3 | file LICENSE

Community examples

Looks like there are no examples yet.