[R] beginners question - kmeans

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Mar 23 08:47:52 CET 2004


You plotted a data frame, and your points are in 17 dimensions.  Why did 
you expect 17 points, and what would they be?  You clustered 91 points 
....

See examples in MASS (the book in the FAQ) for how you can plot 
clusterings.

On Mon, 22 Mar 2004, Louize Hill wrote:

> I am a complete beginner at R and am using the "kmeans" function for the first time...
> I have a data frame (dat) that is 17 columns *  91 rows (including headers)
> 
> I have entered the following:
> cl <- kmeans(dat, 3, 10)
> plot(dat, col = cl$cluster)
> points(cl$centers, col = 1:2, pch = 8)
> 
> the output is 17*17 graphs ...
> this is not what I was anticipating - I was hoping to get one graph 
> with 17 points in 3 clusters!
> can anyone point me in the right direction?


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list