title: parallel k-means in R
body: <p>I am trying to understand how to parallelize some of my code using R. So, in the following example I want to use k-means to cluster data using 2,3,4,5,6 centers, while using 20 iterations. 
  Here is the code: </p>
  
  <pre><code>library(parallel)
  library(BLR)
  
  data(wheat)
  
  parallel.function &lt;- function(i) {
      kmeans( X[1:100,100], centers=?? , nstart=i )
  }
  
  out &lt;- mclapply( c(5, 5, 5, 5), FUN=parallel.function )
  </code></pre>
  
  <p>How can we parallel simultaneously the iterations and the centers? 
  How to track the outputs, assuming I want to keep all the outputs from k-means across all, iterations and centers, just to learn how?</p>