title: how are elements assigned to clusters in foreach() when doing parallel computing in R
body: <p>I have a set of elements to run by user-defined function in R. It takes long time to run for these elements sequentially. Then I switch to parallel computing using <code>foreach()</code>, <code>%dopar%</code>, <code>makecluster()</code>, and <code>registerdoparallel()</code>. I am wondering how are these elements distributed to clusters. Say I have 100 elements and register 5 clusters, Element 1~20 are assigned to cluster 1, and so on so forth, or they are assigned randomly. Thanks</p>