# NOT RUN {
library(metan)
# All rows and all numeric variables from data
d1 <- clustering(data_ge2)
# Based on the mean for each genotype
d2 <- clustering(data_ge2, means_by = GEN)
# Based on the mean of each genotype
# Variables NKR, TKW, and NKE
d3 <- clustering(data_ge2, NKR, TKW, NKE, means_by = GEN)
# Select variables for compute the distances
d4 <- clustering(data_ge2, means_by = GEN, selvar = TRUE)
# Compute the distances with standardized data
# Define 4 clusters
d5 <- clustering(data_ge2,
means_by = GEN,
scale = TRUE,
nclust = 4)
# Compute the distances for each environment
# Select the variables NKR, TKW, and NKE
# Use the mean for each genotype
d6 <- clustering(data_ge2,
NKR, TKW, NKE,
by = ENV,
means_by = GEN)
# Check the correlation between distance matrices
pairs_mantel(d6)
# }
Run the code above in your browser using DataLab