I am trying to find a way to implement this in R as shown in this link Correlation Heatmaps with Hierarchical Clustering. Essentially, the most interesting aspect where I am seeking to apply is the part that allows one to set a threshold as executed with the fcluster
function in python. I am not aware if such function actually exist in R. I will be soo glad if someone with the skill in python and R could help me with that. Thanks for the assistance!
from scipy.spatial.distance import squareform
plt.figure(figsize=(12,5))
dissimilarity = 1 - abs(correlations)
Z = linkage(squareform(dissimilarity), 'complete')
dendrogram(Z, labels=data.columns, orientation='top',
leaf_rotation=90)
# Clusterize the data
threshold = 0.8
labels = fcluster(Z, threshold, criterion='distance') # obtain the clusters