0

I have the following foreach setting in Ubuntu system where I need to have a progress-bar to monitor the progress.

library(doMC)
registerDoMC(cores=detectCores()-1)
total <- 9000
# create progress bar
pb <- txtProgressBar(min = 0, max = total, style = 3)
respar <- foreach(i = 1:total, .combine = rbind)%dopar%{
  setTxtProgressBar(pb, i)
  i**3
}
close(pb)

However, the above the implementation is not working but the output in respar is as expected. Could you please comment if there is something wrong with this approach?

Note: The question is to identify the error in this approach of creating the progress-bar. The other similar questions did not deal with this combination of background setup for progress-bar creation.

Prradep
  • 5,506
  • 5
  • 43
  • 84
  • Possible duplicate of [How do you create a progress bar when using the "foreach()" function in R?](https://stackoverflow.com/questions/5423760/how-do-you-create-a-progress-bar-when-using-the-foreach-function-in-r) – F. Privé Nov 02 '17 at 07:27
  • The approach maybe same, Can you please point out why this snippet is not working? I am looking to know what is hindering the showing of progress bar while execution, but not the code for creating a progress bar. – Prradep Nov 02 '17 at 08:32
  • Your progress bar probably show up, but in all the other parallel sessions, not the main one. – F. Privé Nov 02 '17 at 10:25

0 Answers0