[R] PAM Clustering

Germano Rossi germano.rossi at gmail.com
Thu Aug 17 19:50:52 CEST 2017


Sorry, I never use pam. In the help, you can see that pam require a
dataframe OR a dissimilarity matrix. If diss=FALSE then "euclidean" was use.So,
I interpret that a matrix of dissimilarity is generated automatically.

Problems may be in your data. Indeed

pam(ruspini, 4)$diss

write a dissimilaty matrix

while
pam(MYdata,10)$diss

wite NULL


2017-08-17 16:03 GMT+02:00 Sema Atasever <s.atasever a gmail.com>:

> Dear Germano,
>
> Thank you for your fast reply,
>
> In the above code, *MYData *is the actual data set.
>
> Do not we need to convert *MYData to *the dissimilarity matrix using
> *pam(as.dist(**MYData**), k = 10, diss = TRUE*)*   code line?*
>
> *Regards.*
>
> On Thu, Aug 17, 2017 at 2:58 PM, Germano Rossi <germano.rossi a gmail.com>
> wrote:
>
>> try this
>>
>> MYdata <- read.csv2("data.txt",dec='.')
>> library(cluster)
>> cluster.pam = pam(MYdata,10)
>> table(cluster.pam$clustering)
>> filenameclu = paste("clusters", ".txt")
>> write.table(cluster.pam$clustering, file=filenameclu,sep=",")
>>
>>
>> 2017-08-17 10:28 GMT+02:00 Sema Atasever <s.atasever a gmail.com>:
>>
>>> Dear Authorized Sir / Madam,
>>>
>>> I have a data set in which each row indicates an amino asid and each
>>> column corresponds
>>> to a feature (in total 539 features).
>>> I want to use PAM Clustering usign this data set.
>>>
>>>
>>> *when i ran R script i am getting this error:*
>>> *Error in pam(d, 10) : x is not a numeric dataframe or matrix.*
>>> *Execution halted*
>>>
>>> How can i fix this error? Is there a problem with my dataset?
>>>
>>> Thanks in advance.
>>>
>>>
>>> *PAM clustering codes:*
>>>
>>> MYdata <- read.csv2("data.txt", dec = ".")
>>> attach(MYdata)
>>> d=as.matrix(MYdata)
>>> library(cluster)
>>> cluster.pam = pam(d,10)
>>> table(cluster.pam$clustering)
>>>
>>> filenameclu = paste("clusters", ".txt")
>>> write.table(cluster.pam$clustering, file=filenameclu,sep=",")
>>>
>>> ______________________________________________
>>> R-help a r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posti
>>> ng-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> ==================
>> Germano Rossi, Dipartimento di Psicologia, Universita' degli Studi di
>> Milano Bicocca
>> Piazza dell'Ateneo Nuovo, 1- 20126 Milano - Italy
>>
>
>


-- 
==================
Germano Rossi, Dipartimento di Psicologia, Universita' degli Studi di
Milano Bicocca
Piazza dell'Ateneo Nuovo, 1- 20126 Milano - Italy

	[[alternative HTML version deleted]]



More information about the R-help mailing list