# load libraries library(geomorph) library(shapes) # dryad link with the data # https://datadryad.org/resource/doi:10.5061/dryad.cq5kp20f/2 dat<-readland.tps("dino_gm.tps", specID="imageID") # for the first dataset, drop any specimen with missing data # for all 51, caluclate the sum of all landmarks ptsum<-rep(0,51) for(s in 1:51)ptsum[s]<-sum(dat[,,s]) # any NA value in this vector indicates that specimen has missing data dino_26sp_24pts<-dat[,,!is.na(ptsum)] # check the dimensions, should be 24 2D landmarks for 26 skulls dim(dino_26sp_24pts) # for the second dataset keep landmarks 1,2,4,5,7,10,11,12,15,16,17,19,21 keep<-c(1,2,4,5,7,10,11,12,15,16,17,19,21) # create array of to hold the 13 selected landmarks for 51 skulls dino_36sp_13pts<-array(0, dim=c(13,2,51)) # cycle through specimens, keeping only the landmarks on the list for(i in 1:51) dino_36sp_13pts[,,i]<-dat[keep,1:2,i] #copy the dino names to the new configuration dimnames(dino_36sp_13pts)<-dimnames(dat) #drop and individual with any missing data in the 13 landmarks ptsum<-rep(0,51) for(s in 1:51)ptsum[s]<-sum(dino_36sp_13pts[,,s]) dino_36sp_13pts<-dino_36sp_13pts[,,!is.na(ptsum)] # check the dimensions, should be 13 2D lanmarks for 31 skulls dim(dino_36sp_13pts) # cleanup, delete all object except our two datasets rm(i,s,ptsum,dat,keep)