mite.xy$site<-seq(1:70) (max(mite.xy[,2])-min(mite.xy[,2]))/4 mite.xy.group<-ddply(.data=mite.xy, .variables=.(x, y, site), .fun= summarise, group = if(y <= 2.5) 1 else if (y <= 4.9) 2 else if (y <= 7.3) 3 else 4) mite.xy.group<-mite.xy.group[with(mite.xy.group, order(site)), ] LDA.mite<-lda(mite.env[,1:2],mite.xy.group[,4]) mite.class <- predict(LDA.mite)$class mite.post <- predict(LDA.mite)$posterior mite.table <- table(mite.xy.group[,4], mite.class) diag(prop.table(mite.table, 1))