[R] Using kmeans given cluster centroids and data with NAs

From: <Sophie.Bestley_at_csiro.au>
Date: Thu 31 Mar 2005 - 13:33:25 EST


I have used the functions agnes and cutree to cluster my data (4977 objects x 22 variables) into 8 clusters. I would like to refine the solution using a k-means or similar algorithm, setting the initial cluster centres as the group means from agnes. However my data matrix has NA's in it and the function kmeans does not appear to accept this?

> dim(centres)

[1] 8 22

> dim(data)

[1] 4977 22

> x <- kmeans(data,centres)

Error in kmeans(data, centres) : NA/NaN/Inf in foreign function call (arg 1)

I have looked extensively through the mail archives but cannot find if/where someone has provided the answer.

Thanks in advance,

Sophie Bestley
Pelagic Fisheries and Ecosystems
CSIRO Marine Research
GPO Box 1538
Hobart, Tasmania 7001
AUSTRALIA Phone: +61 3 6232 5048
Fax: +61 3 6232 5053
Email: sophie.bestley@csiro.au
Website: http://www.marine.csiro.au

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Mar 31 13:43:03 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:57 EST