data(centaurea)
pcoRes = pcoa.calc(centaurea, distMethod = "Manhattan")
summary(pcoRes)
plotPoints(pcoRes, axes = c(1,2), col = c("red", "green", "blue", "black"),
pch = c(20,17,8,21), pt.bg = "orange", legend = TRUE, legend.pos = "bottomright")
# 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"
pcoaGower = pcoa.calc(data, distMethod = "Gower", binaryChs = c("stemBranching"),
nominalChs = c("petalColour", "leaves"), ordinalChs = c("taste"))
plotPoints(pcoaGower, axes = c(1,2), col = c("red","green"),
pch = c(20,17), pt.bg = "orange", legend = TRUE, legend.pos = "bottomright")
Run the code above in your browser using DataLab