# NOT RUN {
library(metan)
library(dplyr)
# Compute the mean for genotypes
means = data_ge %>%
select(-c(ENV, REP)) %>%
group_by(GEN) %>%
summarise_all(mean) %>%
select(-GEN)
# Compute the covariance matrix
covmat = cov(means)
# Compute the distance
dist = mahala(means, covmat)
# Dendrogram
dend = as.dendrogram(hclust(as.dist(dist)))
plot(dend)
# }
Run the code above in your browser using DataCamp Workspace