I am trying to do a hierarchical cluster analysis with binary data, and for the distance matrix I applied the function vegdist()
from vegan package:
dist.jac <- vegdist(final_df, method="jaccard", binary = TRUE)
Next, I used the function hclust but I'm not sure if i should use the dissimilarity matrix produced by vegdist()
:
jac <- hclust(dist.jac, method = "ward.D")
or trying something like this (as I've seen):
jac <- hclust(dist(dist.jac), method = "ward.D")
because the function hclust()
requires 'a dissimilarity structure as produced by dist'. But on the other hand the vegan package says that "should provide a drop-in replacement for dist and return a distance object of the same type" and "the function is an alternative to dist". It does not make much sense to me apply dist(dist.jac)
but I've seen doing it so if someone can explain to me which one should I use I would be very grateful!