kelamahim
kelamahim

Reputation: 587

K means set of initial (distinct) cluster centres

I don`t know if the Kmeans algorithm is the appropriate approach but I have the following example.I want to have 6 groups so that in each group the values are in range 1.Group=0%, 2.Group=0-20%, 3.Group=20-40%, 4.Group=40-60%, 5.Group=60-80%, 6.Group=80-100% of the data. Now I want to know if it is possible to set the range of cluster centers so that each value of data will be assigned to one of the groups.I know I can recode the values but was hoping for better approach.

data<-c(27,14,16,0,0,10,7,9,10,19)
k_means<-kmeans(data, centers = ??)

Upvotes: 1

Views: 530

Answers (1)

kelamahim
kelamahim

Reputation: 587

The solution is obvious.i did not set the values according to the % but just for demonstration purposes.

data<-c(27,14,16,0,0,10,7,9,10,19)
k_means<-kmeans(data, c(4,5,8,10))

Upvotes: 1

Related Questions