[R] cclust causes R to crash when using manhattan kmeans

Friedrich.Leisch at tuwien.ac.at Friedrich.Leisch at tuwien.ac.at
Fri Apr 7 09:33:35 CEST 2006


>>>>> On Fri, 07 Apr 2006 09:02:46 +0200,
>>>>> Timo Becker (TB) wrote:

  > Dear R users,
  > When I run the following code, R crashes:

  > require(cclust)
  > x <- matrix(c(0,0,0,1.5,1,-1), ncol=2, byrow=TRUE)
  > cclust(x, centers=x[2:3,], dist="manhattan", method="kmeans")

  > While this works:

  > cclust(x, centers=x[2:3,], dist="euclidean", method="kmeans")

  > I'm posting this here because I am not sure if it is a bug.
  > I've been searching for a manhattan kmeans method and I found a solution 
  > by using the package amap:

  > require(amap)
  > Kmeans(x, x[2:3,], method="manhattan")

  > This works for me, so I don't need the cclust package anymore.
  > Anyway, I wanted to report the cclust behaviour.

  > R version 2.2.1, 2005-12-20, i386-pc-mingw32



Thanks, this is indeed a bug, and has not been noticed yet because it
seems to apply only for very small data sets like your example, for
larger data sets it seems to works fine:

R> require(cclust)
Loading required package: cclust
[1] TRUE
R> x=matrix(rnorm(100), ncol=2)
R> cclust(x, centers=x[2:3,], dist="manhattan", method="kmeans")

                            Clustering on Training Set


Number of Clusters:  2
Sizes  of Clusters:  33 17

Algorithm converged after 4 iterations.
Changes: 12 3 1 1


2 side notes:

* cclust is no longer actively maintained, the code has been
  integrated in my more general package flexclust, see also
  http://www.ci.tuwien.ac.at/~leisch/papers/Leisch-2006.pdf
  (but cclust in flexclust has the same bug, so thanks a lot for
  reporting it).

* r-help is not really the correct place to report bugs, please try to
  contact the package maintainer first, or use r-devel (but only if
  the maintainer does not respond to a direct email). This is not
  because we want to "hide bugs" from the public, but simply to reduce
  traffic on the lists.

Best,
Fritz

-- 
-----------------------------------------------------------------------
Prof. Dr. Friedrich Leisch 

Institut für Statistik                          Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität                  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München                      http://www.ci.tuwien.ac.at/~leisch




More information about the R-help mailing list