From maechler@stat.math.ethz.ch  Tue May 21 09:21:42 2002
From: maechler@stat.math.ethz.ch (maechler@stat.math.ethz.ch)
Date: Tue, 21 May 2002 10:21:42 +0200 (MET DST)
Subject: [Rd] R bug in cluster package (PR#1580)
Message-ID: <200205210821.KAA02494@pubhealth.ku.dk>

>>>>> "DavidH" == David Hitchcock <dhitchco@stat.ufl.edu> writes:

    DavidH> I have apparently found an error in the "pam"
    DavidH> function of the "cluster" library package.  Please
    DavidH> pardon me if this error has been pointed out or if
    DavidH> this e-mail should be directed to someone else.

    DavidH> The problem only started occurring with R version
    DavidH> 1.5.0, which I started using about a week ago.  The
    DavidH> problem occurs when you try to use "pam" with the
    DavidH> input being a dissimilarity matrix instead of a data
    DavidH> matrix; the results when using the dissimilarity
    DavidH> matrix are very strange and not at all like those
    DavidH> obtained when using the data matrix.

    DavidH> For example, try this code:

     library(cluster)
     data(ruspini)
     ## the clustering using a data matrix as the input:
     pam(ruspini,4)
     ## the clustering using a dissimilarity matrix as input:
     pam(daisy(ruspini),4,diss=T)

    DavidH> The clustering results should be the same but are wildly different.

well, "wildly different" is an  ``unusual''  description of

   > daisy(ruspini)
   Error in daisy(ruspini) : NAs in foreign function call (arg 7)

which does happen when  library(methods)  is attached (as it is
for me)  
and  is not new in 1.5.0, (it does happen in the 1.4.x versions
as well, because since then, read.table() does not coerce
integer to numeric anymore).

This is clearly an omission in daisy() which only checks for "numeric"
instead of "integer" as well.

Can you make sure you detach methods, e.g., by

    if(any(i.meth <- search() == "package:methods")) detach(i.meth)

and retry then. For me the result is then almost identical
(apart from the fact that in the 2nd case the medoid coordinates are
 not available, of course!)

    DavidH> Again, this problem started happening with the upgrade to R 1.5.0.

(but not from 1.4.x ...)

    DavidH> David Hitchcock

Thanks for reporting.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] R bug in cluster package (PR#1580)
maechler@stat.math.ethz.ch