Reputation: 1
I have used k-means method to separate some data into two subgroups. What I get is the label (1 or 2) of each sample. Do any of you know how to visualize the clusters? Many thanks!
Upvotes: 0
Views: 25
Reputation: 17432
Here's a start:
> data = data.frame(x = rnorm(100), y = rnorm(100))
> k = kmeans(data, centers = 4)
> plot(y ~ x, data=data, col=k$cluster)
Upvotes: 1