Iam sorry, but again what is the metric used by hclust() to find distance as we pass the function from distfun(). Is there any default metric ?
I used heatmap.2 in R, to create a heatmap. I used the following command :
heatmap.2(as.matrix(mat_data), density.info="none", trace="none", margins =c(12,9), col=my_palette, breaks=seq(96,100,0.5), dendrogram="both")
What is the method used by the heatmap.2 for dendrogram generation? Is it hclust()? If so, what metric (euclidean or manhattan distance) does it use for default, since I have used default parameters in the above command.
1 answer
Please read the manual well. It says
... dendrograms are computed as
dd <- as.dendrogram(hclustfun(distfun(X)))whereXis eitherxort(x).
where distful defaults to stats::dist and hclustfun defaults to stats::hclust.
To get to that, you’ll either need to ask the developer or look into the source code for all instances of hclustfun being used. I’d recommend doing both - the latter approach is great as a learning method.
Log in to answer this question.
Please use the formatting bar (especially the
codeoption) to present your post better. You can use backticks for inline code (`text` becomestext), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.