0

In R, there is a function to generate heatmap with dendrogram, called pheatmap::pheatmap. minkowski is one of the distance measuring options for pheatmap to draw dendrogram. However, how to set the p (The power of the Minkowski distance) in function pheatmap?

Thanks.

WCMC
  • 1,602
  • 3
  • 20
  • 32
  • If you read the documentation more closely you would get the point that @lebelinoz posted. https://cran.r-project.org/web/packages/pheatmap/pheatmap.pdf – M-- Jun 15 '17 at 21:54
  • you mean this one? `# Specifying clustering from distance matrix drows = dist(test, method = "minkowski"); dcols = dist(t(test), method = "minkowski"); pheatmap(test, clustering_distance_rows = drows, clustering_distance_cols = dcols)` – WCMC Jun 15 '17 at 21:58
  • 1
    Exactly. dcols and drows are defined outside of pheatmap. – M-- Jun 15 '17 at 22:00

1 Answers1

1

The Minkowski distance has nothing to do with the pheatmap package. It is part of the dist function in the stats package. If you try ?dist, you'll see that dist has a p parameter specifically for Minkowski method of taking distance:

dist(x, method = "minkowski", p = 2)
lebelinoz
  • 4,890
  • 10
  • 33
  • 56
  • My understanding is that `pheatmap` use `dist` function internally to draw dendrogram. However, I couldn't find how to set the parameter `p`, which is in `dist`, in `pheatmap`. – WCMC Jun 15 '17 at 21:57
  • `dist` is not part of `pheatmap`. It is from the `stats` package, and I use it when I draw heatmaps using different packages. – lebelinoz Jun 15 '17 at 21:58