I have a binary vector whose length is known.
Such a vector contains an unspecified number of 1s.
My goal is
1. to generate as many clusters as the number of 1s
2. to place the 1 as much as possible at the center of its own cluster

Example. Say I have the following binary vector:
v <- c(0,0,1,0,0,0,0,1,0,1,0,0)
Then I have to get 3 clusters.
I can generate a matrix containing the distance of each element from each one 
of the
clusters center (the 1s):

       1st_1    2nd_1  3rd_1
---|-----------------------------------
0 |      2           7          9 
0 |     1            6          8
1 |      0           5          7
0 |      1           4          6
0 |      2           3          5
0 |      3           2          4
0 |      4           1          3
1 |      5           0          2
0 |      6           1          1
1 |      7           2          0
0 |      8           3          1
0 |      9           4          2

Should I input such matrix to R function "dist" and then use for instance PAM 
or KMEAN
to get the expected 3 clusters ?
I would greatly appreciate some help.

Thank you so much.
Maura


tutti i telefonini TIM!


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to