data(centaurea)
clustering.UPGMA = clust(centaurea)
plot(clustering.UPGMA, cex = 0.6, frame.plot = TRUE, hang = -1,
main = "", sub = "", xlab = "", ylab = "distance")
# using Gower's method
data = list(
ID = as.factor(c("id1","id2","id3","id4","id5","id6")),
Population = as.factor(c("Pop1", "Pop1", "Pop2", "Pop2", "Pop3", "Pop3")),
Taxon = as.factor(c("TaxA", "TaxA", "TaxA", "TaxB", "TaxB", "TaxB")),
data = data.frame(
stemBranching = c(1, 1, 1, 0, 0, 0), # binaryChs
petalColour = c(1, 1, 2, 3, 3, 3), # nominalChs; 1=white, 2=red, 3=blue
leaves = c(1,1,1,2,2,3), # nominalChs; 1=simple, 2=palmately compound, 3=pinnately compound
taste = c(2, 2, 2, 3, 1, 1), # ordinal; 1=hot, 2=hotter, 3=hottest
stemHeight = c(10, 11, 14, 22, 23, 21), # quantitative
leafLength = c(8, 7.1, 9.4, 1.2, 2.3, 2.1) ) # quantitative
)
attr(data, "class") = "morphodata"
clustering.GOWER = clust(data, distMethod = "Gower", clustMethod = "UPGMA",
binaryChs = c("stemBranching"),
nominalChs = c("petalColour", "leaves"),
ordinalChs = c("taste"))
plot(clustering.GOWER, cex = 0.6, frame.plot = TRUE, hang = -1,
main = "", sub = "", xlab = "", ylab = "distance")
Run the code above in your browser using DataLab