title: How do I get cluster-distance space from kmeans in R?
body: <p>In python I would use <a href="http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html" rel="nofollow noreferrer">sklearn's kMean</a> to calculate the clusters, then I get the distance of each point within a cluster to the cluster center by using transform().<br>
  I would like to do the same in R, but <a href="http://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html" rel="nofollow noreferrer">R's kMeans</a> in the stats package would only give me the cluster prediction for each point, or only the distance of each <em>feature</em> to cluster center.</p>
  <p>(for clearance clusterpoints are documents in my case and features are words/terms, so my input matrix is a TfIdf-matrix)</p>
  <p>So is there any other kMeans library that i could use, or is there a fine matrix operation that I can apply to resulting prediction/feature-distance/input-matrix to get what I want?</p>
  <p>I would be grateful for any help or hints</p>