[R] kmeans and incom,plete distance matrix concern

Christian Hennig chrish at stats.ucl.ac.uk
Mon Aug 7 18:49:57 CEST 2006


> Thanks everyone for their help so far. I'm very appreciative of the fact that
> people have pointed out that I was heading in the wrong direction.
> I would be most grateful if someone could look over the following simple
> example for me and tell me if this is how to do it.
> I'm assuming by data matrix you mean the 'raw data' organised as a matrix
> Data (not euclidean distance) matrix
>> DF
>  V1 V2 V3 V4
> 1 78 45 34 45
> 2 97 23 67 12
> 3  9 56 12 67
> 4 19 67 23 90
> 5 34 12 78 56
>
> and then
>>  clusters.kmeans <-kmeans(DF, 2)

This should work. (But why don't you try instead of asking first?)

> if I want 2 clusters for example.
>
> Am I also right in thinking that I can say which 'centriods' I want the clustering to be done?

You can specify from which centroids the kmeans iteration should start, if 
you want to.

Christian

>

*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
chrish at stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche



More information about the R-help mailing list