#1-2 bru<-read.csv2("bruslarky.csv") summary(bru) #3 library(vegan) pca.b<-rda(bru[,4:11], scale=T) # pca.b # Call: rda(X = bru[, 4:11], scale = # T) # # Inertia Rank # Total 8 # Unconstrained 8 8 # Inertia is correlations # # Eigenvalues for unconstrained axes: # PC1 PC2 PC3 PC4 PC5 PC6 # 7.639 0.251 0.056 0.021 0.014 0.008 # PC7 PC8 # 0.007 0.005 screeplot(pca.b) #4 aa<-ordiplot(pca.b, type="n", scaling=2) points(aa, what="si") text(aa, what="spe", arrows = T, length=0.03) #4d par(mar=c(5,4,2,5)) aa<-ordiplot(pca.b, type="n", scaling=1, display="si") points(aa, what="si", pch=".") palette(palette.colors(n=6, palette="Paired", alpha=127/256)) ordihull(pca.b, groups=as.character(bru$instar), scaling=1, draw="poly", col=1:6, lty=0) legend(x=1.2, y=0, legend=1:6, fill=1:6, ncol=1, xpd=T, title="Instar") #6 bru.6<-bru[bru$instar==6,] pca.6<-rda(bru.6[,4:11], scale=T) pca.6 # Call: rda(X = bru.6[, 4:11], scale = T) # # Inertia Rank # Total 8 # Unconstrained 8 8 # Inertia is correlations # # Eigenvalues for unconstrained axes: # PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 # 6.831 0.790 0.203 0.061 0.058 0.027 0.020 0.011 screeplot(pca.6) unique(bru.6$species) par(mar=c(5,4,2,7)) aa<-ordiplot(pca.6, type="n", display="si", scaling=1) palette(palette.colors(n=6, palette="Okabe-Ito")) ordispider(pca.6, scaling=1, groups=bru.6$species, col=1:6) legend(x=1.2, y=.5, legend=unique(bru.6$species), lwd=1, col=1:6, ncol=1, xpd=T, title="Species") #7 pako<-read.csv2("pako_opr.csv", row.names = 1) summary(pako) #8 pako[is.na(pako)]<-0 #9 dca.p<-decorana(log(pako+1)) dca.p # all: # decorana(veg = log(pako + 1)) # # Detrended correspondence analysis with 26 segments. # Rescaling of axes with 4 iterations. # # DCA1 DCA2 DCA3 DCA4 # Eigenvalues 0.2543 0.11840 0.06108 0.03274 # Decorana values 0.2641 0.08218 0.04726 0.02332 # Axis lengths 1.9497 1.34634 1.08653 0.95123 sh.names<-make.cepnames(names(pako), seconditem = T) substr(sh.names,5,5)<-toupper(substr(sh.names,5,5)) hist(weights(dca.p, display="sp")) ?weights.decorana sel<-weights(dca.p, display="sp")>20 par(mar=c(5,4,2,2)) aa<-ordiplot(dca.p, type="n", display="sp", scaling=2) text(aa, what="sp", labels=sh.names, select = sel) points(aa, what="sp", select = !sel, col="grey")