title: How to specify distance metric while for kmeans in R?
body: <p>I'm doing kmeans clustering in R with two requirements:</p>
  
  <ol>
  <li><p>I need to specify my own distance function, now it's Pearson Coefficient.</p></li>
  <li><p>I want to do the clustering that uses average of group members as centroids, rather some actual member.
  The reason for this requirement is that I think using average as centroid makes more sense than using an actual member since the members are always not near the real centroid. Please correct me if I'm wrong about this.</p></li>
  </ol>
  
  <p>First I tried the <code>kmeans</code> function in <code>stat</code> package, but this function doesn't allow custom distance method.</p>
  
  <p>Then I found <code>pam</code> function in <code>cluster</code> package. The <code>pam</code> function does allow custom distance metric by taking a <code>dist</code> object as parameter, but it seems to me that by doing this it takes actual members as centroids, which is not what I expect. Since I don't think it can do all the distance computation with just a distance matrix. </p>
  
  <p>So is there some easy way in R to do the kmeans clustering that satisfies both my requirements ?</p>