Function kmeans in library(mva) should do what you want.
Christian
On Fri, 11 Oct 2002, Justin Arnott wrote:
> To Whom It May Concern,
>
> I am currently trying to use R to perform a "kmeans" clustering
of a
> three dimensional data set. In the directory
> R-1.5.1/library/cclust/data/ I have created a file that
> has the following format (only the first few lines are shown for
> brevity):
>
> B X.Vtl X.Vtu
> 1 -0.529043 1.307031 1.625169
> 2 -0.752502 1.132813 1.480548
> 3 -0.769839 0.888365 1.178828
> 4 -0.333035 0.732639 0.802276
> 5 -0.172183 0.636773 1.217721
>
>
> The file has the name test3.tab in that directory. When I then use R,
> I load the data as follows:
>
> >data(test3)
>
> For a simple test, I attempt to use the kmeans method by using the
> command that follows:
>
> > cclust(test3, 2, method="kmeans")
> Error in as.double.default(x) : (list) object cannot be coerced to
> vector type 14
>
>
> Below the command is the error I receive. The matrix that I entered
> does have columns corresponding to variables and rows to observations as
> shown in the documentation so I'm not sure why it is not of the right
> format.
>
> Any help on how to "fix" this error would be greatly
appreciated!!
>
> Thanks,
> Justin Arnott
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
***********************************************************************
Christian Hennig
Seminar fuer Statistik, ETH-Zentrum (LEO), CH-8092 Zuerich (current)
and Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
hennig at stat.math.ethz.ch, http://stat.ethz.ch/~hennig/
hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/
#######################################################################
ich empfehle www.boag.de
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._