pbapply
pbapply copied to clipboard
Nested Progress Bars
This has come up a couple of times so I thought I would raise it for consideration (if feasible). It would be really useful to have "nested" progress bars display in the console for operations that require lapply(outer, lapply(inner)) type operations. At the moment when a pbapply function runs inside another pbapply function the "inner" one overwrites the "outer" one in the console. Example code
outer_results <- pblapply(1:5, function(i) {
# Inner loop with progress bar
inner_results <- pbsapply(1:10, function(j) {
Sys.sleep(0.1) # Simulate some computation
paste("Outer:", i, "Inner:", j)
})
return(inner_results)
})
Ideally it would be good for the "outer" bar to be maintained on top of the current "inner" bar, with the option to remove completed inner bars so the console does not get cluttered. Something like: