Omar14
Omar14

Reputation: 469

R and Matlab Dendograms Structures

I know very little about R, but I need to convert the dendrogram resulted from hierarchical clustering in matlab into R dendrogram structure. The following table shows the dendrogram resulted from hierarchical clustering in matlab function; where the first and the second column are the IDs for the objects or branches, and the third column is the distance.

enter image description here

Is there a way to map this table (or matlab dendrogram) into R dendrogram?

Upvotes: 0

Views: 166

Answers (1)

Prahken
Prahken

Reputation: 160

I think that the easiest way for you to have a dendrogram in R is to use some intermediate results from your matlab analysis instead of using the final table.

Assuming that you have a dissimilarity matrix called Diss_Mat (which you should definitely evaluate at some point of your matlab algorithm), you could do the following

DIST_Mat=as.dist(Diss_Mat) #create a dist type object
dendro=as.dendrogram(hclust(DIST_Mat)) 

where with the second line you perform the hierarchical clustering in R and then you create a dendrogram type object.

Upvotes: 1

Related Questions