title: foreach error "could not find function "%do%""
body: <p>I'm getting </p>
  
  <pre><code>Error in { : task 1 failed - "could not find function "%do%""
  </code></pre>
  
  <p>when running this code</p>
  
  <pre><code>....
  niters = 1000
  mFR &lt;- foreach(i=1:iters, .combine=rbind) %dopar% {
            foreach(j=1:iters, .combine=c) %do% {
                mp2 &lt;- mp[sample(1:1e6, iters)]
                fexist = 0
                if (mp2[j]&gt;mR12[i]) {
                     Frv = 1
                     fexist = 1
                } else if (mp2[j]&lt;=mRy2[i]) {
                     Frv = 0
                     fexist = 1
                }  else {
                     if (mRy2[i]&gt;mR12[i]) {
                        Frv = 1
                     } else {
                        fexist = 1
                        b = mDMDuc1[i]/(1-mR12[i]/mRy2[i])
                        m = -b/mRy2[i]
                        DMDp = m*mp2[j] + b
                        Frv = (DMDp - 0)/(mDMDc2[i] - 0)
                     }
                }
                if (fexist==1) {
                   mFR &lt;- matrix(Frv, ncol=1, nrow = 1)
                   mFR
                }
             }
  }
  </code></pre>
  
  <p>Any idea why this error happens? Thanks!</p>