R kmeans final distance to to centroid
<p>I have run a <code>kmeans</code> algorithm on the <code>iris</code> dataset in <code>R</code> using the command <code>kmeans_iris &lt;- kmeans(iris[,1:4], centers=3)</code>. I now want to know the distance from a given observation in the <code>iris</code> dataset to its corresponding cluster's centroid. I could write code to manually calculate the Euclidean distance from an observation to the <code>centers</code> corresponding to its cluster, but is there not an easy, built-in way to do this? </p>