Is it possible to have R wait before starting the next task?

132 views Asked by At

My question is: is it possible to have R wait, e.g. for x minutes, before starting the next task?

The background to this question is that I have R do calculations (imputations) in multiple instances to save time. The final step is combining results across instances (i.e. loading saved files) and do more calulations on the combined data (bootstrapping).

I need one instance of R that will do the second task (bootstrapping) to wait for all instances to finish the first task (imputations). Since all tasks take about equally long, it would be enough to have that instance wait for x minutes to make sure all other instances finished the first task.

For optimization, it would also be interesting if R can check if a different instance finished the first task. But since this is perhaps much more complicated, I would be content with a solution to the first question.

Edit: After considering the comments by Joshua Ulrich, it may be useful to run the imputations in parallel. I use the the imputation package MICE under R to generate imputations. So far I would let it run in multiple instances and then use ibind to combine the multiply imputed data sets. Can somebody advise on how to use parallel processing on MICE?

0

There are 0 answers