title: How to create a cluster plot in R?
body: <p>How can I create a cluster plot in R without using <a href="http://stat.ethz.ch/R-manual/R-devel/library/cluster/html/clusplot.default.html" rel="nofollow noreferrer">clustplot</a>?</p>
  
  <p>I am trying to get to grips with some clustering (using R) and visualisation (using HTML5 Canvas). </p>
  
  <p>Basically, I want to create a <a href="http://stat.ethz.ch/R-manual/R-devel/library/cluster/html/clusplot.default.html" rel="nofollow noreferrer">cluster plot</a> but instead of plotting the data, I want to get a set of 2D points or coordinates that I can pull into canvas and do something might pretty with (but I am unsure of how to do this). I would imagine that I:</p>
  
  <ol>
  <li>Create a similarity matrix for the entire dataset (using dist)</li>
  <li>Cluster the similarity matrix using kmeans or something similar (using kmeans)</li>
  <li>Plot the result using MDS or PCA - but I am unsure of how steps 2 and 3 relate (cmdscale). </li>
  </ol>
  
  <p>I've checked out questions <a href="https://stackoverflow.com/questions/5084077/r-draw-kmeans-clustering-with-heatmap">here</a>, <a href="https://stackoverflow.com/questions/3033594/how-to-create-a-clustergram-plot-in-r">here</a> and <a href="https://stackoverflow.com/questions/7500193/should-one-use-distances-dissimilarities-or-similarities-in-r-for-clustering">here</a> (with the last one being of most use). </p>