Re: [R] keep the centre fixed in K-means clustering

2013-05-22 Thread HJ YAN
Dear Uwe Just wanted to say thank you so much for this as whilst waiting for a reply from r-help I had been wrting a piece of ugly code as below to do the job and yours looks MUCH smarter and I especially like the use of '-apply()' bit as there is no 'min.col()' function. p.s. my data has 144 val

Re: [R] keep the centre fixed in K-means clustering

2013-05-22 Thread Uwe Ligges
So you just want to compare the distances from each point of your new data to each of the Centres and assign the corresponding number of the centre as in: clust <- apply(NewData, 1, function(x) which.min(colSums(x - tCentre)^2 but since the apply loop is rather long here for lots of new d

[R] keep the centre fixed in K-means clustering

2013-05-21 Thread HJ YAN
Dear R users I have the matrix of the centres of some clusters, e.g. 20 clusters each with 100 dimentions, so this matrix contains 20 rows * 100 columns numeric values. I have collected new data (each with 100 numeric values) and would like to keep the above 20 centres fixed/'unmoved' whilst jus