On Tue, 2010-09-07 at 12:16 +0100, Christian Hennig wrote: > The kmeans function doesn't accept a distance object or distance matrix as > input (which you can of course generate from your own definition), but pam > in package cluster does. (Note that the term "k-means" refers to cluster > mean vectors, which can only computed from a cases*variables data matrix, > not from distances alone.) > > There are also several other clustering methods that work with distance > matrices as input, see for example hclust, agnes from package cluster or > dbscan from package fpc, but if you want something that is > conceptually close to k-means, you should probably go for pam.
In addition to Christian's comments, the flexclust package also allows k-centroids clustering with arbitrary distance coefficients and computation of centroids. G > > Best regards, > Christian > > On Tue, 7 Sep 2010, Karen Sargsyan wrote: > > > Is it possible to implement my own distance and mean for k-means clustering > > for any clustering package in R? > > Just looking for simple way, without creating a new package. > > > > karsar > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > *** --- *** > Christian Hennig > University College London, Department of Statistical Science > Gower St., London WC1E 6BT, phone +44 207 679 1698 > chr...@stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.