Implement Clustering Algorithm In R