title: adding labels to 2D scatter plot (kmeans clustering)
body: <p>I calculated PCA on the samples of my dataset and retained the first two components vectors .I then calculated k-means clustering on these first two components with k=3.
  Now I need to plot a 2D scatter plot with the first two eigenfunctions (from PCA) and color based on the cluster group. I accomplished everything with the scatter plot but when I look at the plot I cannot differentiate which samples are clustered so I want to add the sample labels to the points in scatter plot.
  Can anybody suggest me how to go about this?</p>
  
  <pre><code>tdata&lt;-t(subdata)
  pca &lt;- prcomp((tdata),cor=F)
  dat.loadings &lt;-pca$x[,1:2]
  cl &lt;- kmeans(dat.loadings, centers=3)
  pca1 &lt;-pca$x[,1]
  pca2 &lt;-pca$x[,2]
  plot(pca1, pca2,xlab="PCA-1",ylab="PCA-2",col=cl$cluster)
  </code></pre>
  
  <p>Thank you</p>