if (FALSE) {
require(geomorph)
## Loading the plethodon dataset
data(plethodon)
## Performing a Procrustes transform
procrustes <- geomorph::gpagen(plethodon$land, PrinAxes = FALSE)
## Obtaining the ordination matrix
geomorph.ordination(procrustes)
## Using a geomorph.data.frame
geomorph_df <- geomorph.data.frame(procrustes, species = plethodon$species)
geomorph.ordination(geomorph_df)
## Calculating disparity from dispRity or geomorph::morphol.disparity
geomorph_disparity <- geomorph::morphol.disparity(coords ~ 1,
groups= ~ species, data = geomorph_df)
dispRity_disparity <- dispRity(geomorph.ordination(geomorph_df),
metric = function(X) return(sum(X^2)/nrow(X)))
## Extracting the raw disparity values
geomorph_val <- round(as.numeric(geomorph_disparity$Procrustes.var), 15)
dispRity_val <- as.vector(summary(dispRity_disparity, digits = 15)$obs)
## Comparing the values (to the 15th decimal!)
geomorph_val == dispRity_val # all TRUE
}
Run the code above in your browser using DataLab