When a specification curve analysis requires the estimation of several thousand models, the procedure can take quite a while. In those cases, it would be nice to have some sort of indicator of the progress (both to feel confident that the procedure is still running and to have an idea of how long the procedure will still take).
To run the specification curve with a progress bar, we need to include
pb$tick() in the model function.
Next, we can use the function
progress_bar() from the package
progress. The only thing we need to due is provide the number of ticks (i.e., operations) that will be computed
library(progress) # Provide number of ticks pb <- progress_bar$new(format = "[:bar] | :percent (:current/:total) | Finished in:eta", width = 100, total = 192)
The console will now show a progress bar during estimation. For more information and additional customizations see: https://github.com/r-lib/progress.
## # A tibble: 1 x 7 ## median mad min max q25 q75 obs ## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 3.59 4.56 -2.05 9.58 1.03 7.63 123