Anyone have any recommendations for how to set-up a progress bar from dplyr::progress_estimated()
without explicitly creating the progress bar outside of the function?
This is the crux of what I usually do:
mydata <- tibble(x = ..., y = ..., z = ...)
progress_bar <- mydata %>%
tally() %>%
progress_estimated(min_time = 0)
myfunction <- function(x, y, z, ...) {
progress_bar$tick()$print()
function_stuff <- x + y + z
return(function_stuff)
}
map(mydata, myfunction)
My issue is that I'd like to do this without doing the initial progress_bar <- progress_estimated(...)
outside of the function. I'm trying to use a progress bar in a function that I'm adding to a package, and I feel like it wouldn't be right to assume that users will create their own progress bars each time.
Any ideas? Am I making any sense?