# purrr::map
progressr::with_progress(
purrr_bar(rep(0.25, 5), .purrr = purrr::map, .f = Sys.sleep, .steps = 5)
)
# \donttest{
# purrr::walk
progressr::with_progress(
purrr_bar(rep(0.25, 5), .purrr = purrr::walk,.f = Sys.sleep, .steps = 5)
)
# progress bar off
progressr::with_progress(
purrr_bar(
rep(0.25, 5), .purrr = purrr::walk,.f = Sys.sleep, .steps = 5, .progress = FALSE
)
)
# purrr::map2
progressr::with_progress(
purrr_bar(
rep(1, 5), rep(2, 5),
.purrr = purrr::map2,
.f = `+`,
.steps = 5,
.slow = TRUE
)
)
# purrr::pmap
progressr::with_progress(
purrr_bar(
list(rep(1, 5), rep(2, 5)),
.purrr = purrr::pmap,
.f = `+`,
.steps = 5,
.slow = TRUE
)
)
# define function within purr_bar() call
progressr::with_progress(
purrr_bar(
list(rep(1, 5), rep(2, 5)),
.purrr = purrr::pmap,
.f = function(x, y) {
paste0(x, y)
},
.steps = 5,
.slow = TRUE
)
)
# with mutate
progressr::with_progress(
tibble::tibble(x = rep(0.25, 5)) %>%
dplyr::mutate(x = purrr_bar(x, .purrr = purrr::map, .f = Sys.sleep, .steps = 5))
)
# }
Run the code above in your browser using DataLab