hop of those help? It happens that you capture only the cluster element of the return value of kmeans, which returns also the centers of the clusters. Try this:

code :

```
#generate some data
traindata<-matrix(rnorm(400),ncol=2)
traindata=scale(traindata,center = T,scale=T) # Feature Scaling
#get the full kmeans
km.cluster = kmeans(traindata, 2,iter.max=20,nstart=25)
#define a (euclidean) distance function between two matrices with two columns
myDist<-function(p1,p2) sqrt((p1[,1]-p2[,1])^2+(p1[,2]-p2[,2])^2)
#gets the distances
myDist(traindata[km.cluster$cluster==1,],km.cluster$centers[1,,drop=FALSE])
myDist(traindata[km.cluster$cluster==2,],km.cluster$centers[2,,drop=FALSE])
```