Here we achieve two tasks within one function: Implementing a progress bar, and running our code in parallel.
For the progress bar, I chose the progressr package by Henrik Bengtsson which offers a powerful API so that not only built-in progress bars like the text progress bar, but also external progress signals can be used, such as acoustic signals via the beepr package.
Parallel code execution is shown by means of the future framework, also developed by Henrik Bengtsson, and the future.apply package. This way, our function code can remain stable regardless whether we want to evaluate sequentially or on one of several parallel backends.
Code can be found here:
[ Ссылка ]
Video on Running R code in parallel using parallel::clusterApply()
[ Ссылка ]
Running loops in parallel in R using foreach
[ Ссылка ]
Running R Code in Parallel: What if run times differ? clusterApplyLB
[ Ссылка ]
Contact me, e. g. to discuss (online) R workshops / trainings / webinars:
LinkedIn: [ Ссылка ]
Twitter: [ Ссылка ]
Xing: [ Ссылка ]
Facebook: [ Ссылка ]
[ Ссылка ]
R Workshops: [ Ссылка ]
Blog (German, translate option): [ Ссылка ]
Playlist: Music chart history
[ Ссылка ]
![](https://s2.save4k.ru/pic/AsaCfw66nZM/maxresdefault.jpg)