Hi Brendon,
I have been experimenting with the geomorph package recently doing a morphometric analysis on juvenile salmon. Please find the code below that loads landmarks (15 per fish) stored in TPS files into a 3D array, performs the generalized procrustes analysis with the gpagen() function and plots the results with the plotTangentSpace() function. Note the dimensions of the array (15, 2, 27). In my case I had 15 landmarks, 2 dimensions (x and y), and 27 fish.
Although the output has been useful, I have been computing the distances between landmarks after the procrustes analysis manually and running a separate PCA with the prcomp() function which has given me more control over the output. Now I am working on a biological interpretation of the principal components. I am fairly new to PCA analysis, so if you have any advice on ways to interpret principal components in a way that would be biologically meaningful, I would love to hear it.
library(geomorph)
files <- list.files("C:/path/to/your/tps/files", pattern = ".TPS")
for(i in 1:length(files)){
print(files[i])
temp <- readland.tps(paste("C:/path/to/your/tps/files/", files[i], sep = ""))
assign(paste("land",i, sep = ""),value = temp)
}
##Combine landmark matrices into one array
landslist <- array(c(land1,land2,land3,land4,land5,land6,land7,land8,land9,
land10,land11,land12,land13,land14,land15,land16,land17,land18,land19,
land20,land21,land22,land23,land24,land25,land26,land27), dim = c(15,2,27))
dimnames(landslist)[[3]] <- files
##Procrustes analysis
gpag <- gpagen(landslist)
##geomorph PCA plot
pca.lands <- plotTangentSpace(gpag$coords, label = T, verbose = T)