pbapply
Last week I had a long running apply
(essentially running correlations on vectors that were of length around 10^5, I had around 10^5 of these vectors to compare to a “reference”). It was taking a long time on my laptop, so I wanted a way to see how long it would take to see if I should use an HPC cluster instead.
If I had been using a for
loop I would have been able to easily print an index, or use a progress bar library, but that wasn’t really an option with apply
. I found a nice library called pbapply that serves this purpose nicely. It essentially adds a progress bar for interactive R sessions and you just need to replace apply
with pbapply
.
This helped me know that my analysis would only take around 30-40min on my laptop, so I decided to wait it out and not use HPC.