Re: [R] pam() seems to ignore cluster number

From: Martin Maechler <>
Date: Tue, 24 May 2011 08:50:17 +0200

>>>>> Dario Strbenac <> >>>>> on Wed, 18 May 2011 12:00:11 +1000 writes:

> I am using PAM with k = 10 clusters, but I only get one cluster
> ID for all my observations. I couldn't find any discussion about
> this in the help file, or mailing lists. Is there a reasonable
> explanation for this result ?

> cIDs <- pam(all, 10, cluster.only = TRUE, do.swap = FALSE)

    >> table(cIDs)

> cIDs
> 0
> 16671

> The matrix of observations can be found at :

For the mailing list archives:

Dario's data contained so many NA's that some of the computed dissimalirities "had to be" NA as well.
Had he used

    pam(all, 10)
    pam(all, 10, do.swap = FALSE)

he would have got the error message

   "No clustering performed, NAs in the computed dissimilarity matrix."

But because of 'cluster.only=TRUE'
*and* because of a lapsus of the 'cluster' maintainer (me), pam() returned without the error message in this case.

The next release of R (or of 'cluster') will give the error message also in the case of 'cluster.only=TRUE' .

Martin Maechler, ETH Zurich

> I'm using R version 2.13.0 (2011-04-13) on Platform:
> x86_64-unknown-linux-gnu (64-bit) and have cluster_1.13.3.

> --------------------------------------
> Dario Strbenac
> Research Assistant
> Cancer Epigenetics
> Garvan Institute of Medical Research
> Darlinghurst NSW 2010
> Australia mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 24 May 2011 - 07:14:46 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 May 2011 - 07:30:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive